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, project_id, description, size,
23 vol_type, availability_zone, multi_attach,
27 :param name: the volume's name
28 :param volume_id: the volume's id
29 :param project_id: the volume's associated project id
30 :param description: the volume's description
31 :param size: the volume's size in GB
32 :param vol_type: the volume's type
33 :param availability_zone: the volume's availability zone
34 :param multi_attach: When true, volume can be attached to multiple VMs
35 :param attachments: List of dict objects containing the info on where
36 this volume is attached
40 self.project_id = project_id
41 self.description = description
44 self.availability_zone = availability_zone
45 self.multi_attach = multi_attach
46 self.attachments = attachments
48 def __eq__(self, other):
49 return (self.name == other.name
50 and self.id == other.id
51 and self.project_id == other.project_id
52 and self.description == other.description
53 and self.size == other.size
54 and self.type == other.type
55 and self.availability_zone == other.availability_zone
56 and self.multi_attach == other.multi_attach)
61 SNAPS domain object for Volume Types. Should contain attributes that
62 are shared amongst cloud providers
64 def __init__(self, name, volume_type_id, public, encryption, qos_spec):
67 :param name: the volume's name
68 :param volume_type_id: the volume type's id
69 :param public: True if public
70 :param encryption: instance of a VolumeTypeEncryption domain object
71 :param qos_spec: instance of a QoSSpec domain object
74 self.id = volume_type_id
76 self.encryption = encryption
77 self.qos_spec = qos_spec
79 def __eq__(self, other):
80 return (self.name == other.name and self.id == other.id
81 and self.public == other.public
82 and self.encryption == other.encryption
83 and self.qos_spec == other.qos_spec)
86 class VolumeTypeEncryption:
88 SNAPS domain object for Volume Types. Should contain attributes that
89 are shared amongst cloud providers
91 def __init__(self, volume_encryption_id, volume_type_id,
92 control_location, provider, cipher, key_size):
95 :param volume_encryption_id: the encryption id
96 :param volume_type_id: the associated volume type's id
97 :param control_location: front-end | back-end
98 :param provider: the encryption provider class
99 :param cipher: the encryption cipher
100 :param key_size: the encryption key size
102 self.id = volume_encryption_id
103 self.volume_type_id = volume_type_id
104 self.control_location = control_location
105 self.provider = provider
107 self.key_size = key_size
109 def __eq__(self, other):
110 return (self.id == other.id
111 and self.volume_type_id == other.volume_type_id
112 and self.control_location == other.control_location
113 and self.provider == other.provider
114 and self.cipher == other.cipher
115 and self.key_size == other.key_size)
120 SNAPS domain object for Volume Types. Should contain attributes that
121 are shared amongst cloud providers
123 def __init__(self, name, spec_id, consumer):
126 :param name: the volume's name
127 :param spec_id: the QoS Spec's id
131 self.consumer = consumer
133 def __eq__(self, other):
134 return (self.name == other.name and self.id == other.id
135 and self.consumer == other.consumer)