1 # Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
2 # and others. All rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 SNAPS domain object for Volumes. Should contain attributes that
20 are shared amongst cloud providers
22 def __init__(self, name, volume_id, description, size, vol_type,
23 availability_zone, multi_attach, attachments=list()):
26 :param name: the volume's name
27 :param volume_id: the volume's id
28 :param description: the volume's description
29 :param size: the volume's size in GB
30 :param vol_type: the volume's type
31 :param availability_zone: the volume's availability zone
32 :param multi_attach: When true, volume can be attached to multiple VMs
33 :param attachments: List of dict objects containing the info on where
34 this volume is attached
38 self.description = description
41 self.availability_zone = availability_zone
42 self.multi_attach = multi_attach
43 self.attachments = attachments
45 def __eq__(self, other):
46 return (self.name == other.name and self.id == other.id
47 and self.description == other.description
48 and self.size == other.size
49 and self.type == other.type
50 and self.availability_zone == other.availability_zone
51 and self.multi_attach == other.multi_attach)
56 SNAPS domain object for Volume Types. Should contain attributes that
57 are shared amongst cloud providers
59 def __init__(self, name, volume_type_id, public, encryption, qos_spec):
62 :param name: the volume's name
63 :param volume_type_id: the volume type's id
64 :param public: True if public
65 :param encryption: instance of a VolumeTypeEncryption domain object
66 :param qos_spec: instance of a QoSSpec domain object
69 self.id = volume_type_id
71 self.encryption = encryption
72 self.qos_spec = qos_spec
74 def __eq__(self, other):
75 return (self.name == other.name and self.id == other.id
76 and self.public == other.public
77 and self.encryption == other.encryption
78 and self.qos_spec == other.qos_spec)
81 class VolumeTypeEncryption:
83 SNAPS domain object for Volume Types. Should contain attributes that
84 are shared amongst cloud providers
86 def __init__(self, volume_encryption_id, volume_type_id,
87 control_location, provider, cipher, key_size):
90 :param volume_encryption_id: the encryption id
91 :param volume_type_id: the associated volume type's id
92 :param control_location: front-end | back-end
93 :param provider: the encryption provider class
94 :param cipher: the encryption cipher
95 :param key_size: the encryption key size
97 self.id = volume_encryption_id
98 self.volume_type_id = volume_type_id
99 self.control_location = control_location
100 self.provider = provider
102 self.key_size = key_size
104 def __eq__(self, other):
105 return (self.id == other.id
106 and self.volume_type_id == other.volume_type_id
107 and self.control_location == other.control_location
108 and self.provider == other.provider
109 and self.cipher == other.cipher
110 and self.key_size == other.key_size)
115 SNAPS domain object for Volume Types. Should contain attributes that
116 are shared amongst cloud providers
118 def __init__(self, name, spec_id, consumer):
121 :param name: the volume's name
122 :param spec_id: the QoS Spec's id
126 self.consumer = consumer
128 def __eq__(self, other):
129 return (self.name == other.name and self.id == other.id
130 and self.consumer == other.consumer)