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):
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
36 self.description = description
39 self.availability_zone = availability_zone
40 self.multi_attach = multi_attach
42 def __eq__(self, other):
43 return (self.name == other.name and self.id == other.id
44 and self.description == other.description
45 and self.size == other.size
46 and self.type == other.type
47 and self.availability_zone == other.availability_zone
48 and self.multi_attach == other.multi_attach)
53 SNAPS domain object for Volume Types. Should contain attributes that
54 are shared amongst cloud providers
56 def __init__(self, name, volume_type_id, public, encryption, qos_spec):
59 :param name: the volume's name
60 :param volume_type_id: the volume type's id
61 :param public: True if public
62 :param encryption: instance of a VolumeTypeEncryption domain object
63 :param qos_spec: instance of a QoSSpec domain object
66 self.id = volume_type_id
68 self.encryption = encryption
69 self.qos_spec = qos_spec
71 def __eq__(self, other):
72 return (self.name == other.name and self.id == other.id
73 and self.public == other.public
74 and self.encryption == other.encryption
75 and self.qos_spec == other.qos_spec)
78 class VolumeTypeEncryption:
80 SNAPS domain object for Volume Types. Should contain attributes that
81 are shared amongst cloud providers
83 def __init__(self, volume_encryption_id, volume_type_id,
84 control_location, provider, cipher, key_size):
87 :param volume_encryption_id: the encryption id
88 :param volume_type_id: the associated volume type's id
89 :param control_location: front-end | back-end
90 :param provider: the encryption provider class
91 :param cipher: the encryption cipher
92 :param key_size: the encryption key size
94 self.id = volume_encryption_id
95 self.volume_type_id = volume_type_id
96 self.control_location = control_location
97 self.provider = provider
99 self.key_size = key_size
101 def __eq__(self, other):
102 return (self.id == other.id
103 and self.volume_type_id == other.volume_type_id
104 and self.control_location == other.control_location
105 and self.provider == other.provider
106 and self.cipher == other.cipher
107 and self.key_size == other.key_size)
112 SNAPS domain object for Volume Types. Should contain attributes that
113 are shared amongst cloud providers
115 def __init__(self, name, spec_id, consumer):
118 :param name: the volume's name
119 :param spec_id: the QoS Spec's id
123 self.consumer = consumer
125 def __eq__(self, other):
126 return (self.name == other.name and self.id == other.id
127 and self.consumer == other.consumer)