oraclebmc 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +82 -0
  3. data/README.md +220 -0
  4. data/lib/oraclebmc/api_client.rb +349 -0
  5. data/lib/oraclebmc/config.rb +80 -0
  6. data/lib/oraclebmc/config_file_loader.rb +85 -0
  7. data/lib/oraclebmc/core/blockstorage_client.rb +459 -0
  8. data/lib/oraclebmc/core/compute_client.rb +1053 -0
  9. data/lib/oraclebmc/core/core.rb +82 -0
  10. data/lib/oraclebmc/core/models/attach_i_scsi_volume_details.rb +179 -0
  11. data/lib/oraclebmc/core/models/attach_volume_details.rb +206 -0
  12. data/lib/oraclebmc/core/models/capture_console_history_details.rb +162 -0
  13. data/lib/oraclebmc/core/models/console_history.rb +252 -0
  14. data/lib/oraclebmc/core/models/cpe.rb +209 -0
  15. data/lib/oraclebmc/core/models/create_cpe_details.rb +187 -0
  16. data/lib/oraclebmc/core/models/create_dhcp_details.rb +195 -0
  17. data/lib/oraclebmc/core/models/create_drg_attachment_details.rb +184 -0
  18. data/lib/oraclebmc/core/models/create_drg_details.rb +173 -0
  19. data/lib/oraclebmc/core/models/create_image_details.rb +188 -0
  20. data/lib/oraclebmc/core/models/create_internet_gateway_details.rb +195 -0
  21. data/lib/oraclebmc/core/models/create_ip_sec_connection_details.rb +210 -0
  22. data/lib/oraclebmc/core/models/create_route_table_details.rb +195 -0
  23. data/lib/oraclebmc/core/models/create_security_list_details.rb +206 -0
  24. data/lib/oraclebmc/core/models/create_subnet_details.rb +253 -0
  25. data/lib/oraclebmc/core/models/create_vcn_details.rb +187 -0
  26. data/lib/oraclebmc/core/models/create_volume_backup_details.rb +173 -0
  27. data/lib/oraclebmc/core/models/create_volume_details.rb +211 -0
  28. data/lib/oraclebmc/core/models/dhcp_dns_option.rb +203 -0
  29. data/lib/oraclebmc/core/models/dhcp_option.rb +171 -0
  30. data/lib/oraclebmc/core/models/dhcp_options.rb +246 -0
  31. data/lib/oraclebmc/core/models/drg.rb +224 -0
  32. data/lib/oraclebmc/core/models/drg_attachment.rb +246 -0
  33. data/lib/oraclebmc/core/models/egress_security_rule.rb +240 -0
  34. data/lib/oraclebmc/core/models/i_scsi_volume_attachment.rb +254 -0
  35. data/lib/oraclebmc/core/models/icmp_options.rb +173 -0
  36. data/lib/oraclebmc/core/models/image.rb +282 -0
  37. data/lib/oraclebmc/core/models/ingress_security_rule.rb +240 -0
  38. data/lib/oraclebmc/core/models/instance.rb +326 -0
  39. data/lib/oraclebmc/core/models/internet_gateway.rb +248 -0
  40. data/lib/oraclebmc/core/models/ip_sec_connection.rb +261 -0
  41. data/lib/oraclebmc/core/models/ip_sec_connection_device_config.rb +195 -0
  42. data/lib/oraclebmc/core/models/ip_sec_connection_device_status.rb +198 -0
  43. data/lib/oraclebmc/core/models/launch_instance_details.rb +327 -0
  44. data/lib/oraclebmc/core/models/port_range.rb +175 -0
  45. data/lib/oraclebmc/core/models/route_rule.rb +177 -0
  46. data/lib/oraclebmc/core/models/route_table.rb +246 -0
  47. data/lib/oraclebmc/core/models/security_list.rb +257 -0
  48. data/lib/oraclebmc/core/models/shape.rb +164 -0
  49. data/lib/oraclebmc/core/models/subnet.rb +325 -0
  50. data/lib/oraclebmc/core/models/tcp_options.rb +177 -0
  51. data/lib/oraclebmc/core/models/tunnel_config.rb +193 -0
  52. data/lib/oraclebmc/core/models/tunnel_status.rb +218 -0
  53. data/lib/oraclebmc/core/models/udp_options.rb +177 -0
  54. data/lib/oraclebmc/core/models/update_cpe_details.rb +162 -0
  55. data/lib/oraclebmc/core/models/update_dhcp_details.rb +172 -0
  56. data/lib/oraclebmc/core/models/update_drg_attachment_details.rb +162 -0
  57. data/lib/oraclebmc/core/models/update_drg_details.rb +162 -0
  58. data/lib/oraclebmc/core/models/update_image_details.rb +165 -0
  59. data/lib/oraclebmc/core/models/update_instance_details.rb +165 -0
  60. data/lib/oraclebmc/core/models/update_internet_gateway_details.rb +173 -0
  61. data/lib/oraclebmc/core/models/update_ip_sec_connection_details.rb +162 -0
  62. data/lib/oraclebmc/core/models/update_route_table_details.rb +173 -0
  63. data/lib/oraclebmc/core/models/update_security_list_details.rb +184 -0
  64. data/lib/oraclebmc/core/models/update_subnet_details.rb +162 -0
  65. data/lib/oraclebmc/core/models/update_vcn_details.rb +162 -0
  66. data/lib/oraclebmc/core/models/update_volume_backup_details.rb +162 -0
  67. data/lib/oraclebmc/core/models/update_volume_details.rb +163 -0
  68. data/lib/oraclebmc/core/models/vcn.rb +272 -0
  69. data/lib/oraclebmc/core/models/vnic.rb +274 -0
  70. data/lib/oraclebmc/core/models/vnic_attachment.rb +271 -0
  71. data/lib/oraclebmc/core/models/volume.rb +249 -0
  72. data/lib/oraclebmc/core/models/volume_attachment.rb +284 -0
  73. data/lib/oraclebmc/core/models/volume_backup.rb +273 -0
  74. data/lib/oraclebmc/core/util.rb +1 -0
  75. data/lib/oraclebmc/core/virtual_network_client.rb +2263 -0
  76. data/lib/oraclebmc/errors.rb +62 -0
  77. data/lib/oraclebmc/global_context.rb +21 -0
  78. data/lib/oraclebmc/identity/identity.rb +38 -0
  79. data/lib/oraclebmc/identity/identity_client.rb +1462 -0
  80. data/lib/oraclebmc/identity/models/add_user_to_group_details.rb +173 -0
  81. data/lib/oraclebmc/identity/models/api_key.rb +251 -0
  82. data/lib/oraclebmc/identity/models/availability_domain.rb +173 -0
  83. data/lib/oraclebmc/identity/models/compartment.rb +251 -0
  84. data/lib/oraclebmc/identity/models/create_api_key_details.rb +162 -0
  85. data/lib/oraclebmc/identity/models/create_compartment_details.rb +187 -0
  86. data/lib/oraclebmc/identity/models/create_group_details.rb +186 -0
  87. data/lib/oraclebmc/identity/models/create_policy_details.rb +215 -0
  88. data/lib/oraclebmc/identity/models/create_swift_password_details.rb +163 -0
  89. data/lib/oraclebmc/identity/models/create_user_details.rb +186 -0
  90. data/lib/oraclebmc/identity/models/group.rb +251 -0
  91. data/lib/oraclebmc/identity/models/policy.rb +277 -0
  92. data/lib/oraclebmc/identity/models/swift_password.rb +266 -0
  93. data/lib/oraclebmc/identity/models/ui_password.rb +227 -0
  94. data/lib/oraclebmc/identity/models/update_compartment_details.rb +162 -0
  95. data/lib/oraclebmc/identity/models/update_group_details.rb +162 -0
  96. data/lib/oraclebmc/identity/models/update_policy_details.rb +190 -0
  97. data/lib/oraclebmc/identity/models/update_state_details.rb +163 -0
  98. data/lib/oraclebmc/identity/models/update_swift_password_details.rb +162 -0
  99. data/lib/oraclebmc/identity/models/update_user_details.rb +162 -0
  100. data/lib/oraclebmc/identity/models/user.rb +257 -0
  101. data/lib/oraclebmc/identity/models/user_group_membership.rb +249 -0
  102. data/lib/oraclebmc/identity/util.rb +1 -0
  103. data/lib/oraclebmc/load_balancer/load_balancer.rb +45 -0
  104. data/lib/oraclebmc/load_balancer/load_balancer_client.rb +1218 -0
  105. data/lib/oraclebmc/load_balancer/models/backend.rb +262 -0
  106. data/lib/oraclebmc/load_balancer/models/backend_details.rb +248 -0
  107. data/lib/oraclebmc/load_balancer/models/backend_set.rb +211 -0
  108. data/lib/oraclebmc/load_balancer/models/backend_set_details.rb +197 -0
  109. data/lib/oraclebmc/load_balancer/models/certificate.rb +209 -0
  110. data/lib/oraclebmc/load_balancer/models/certificate_details.rb +245 -0
  111. data/lib/oraclebmc/load_balancer/models/create_backend_details.rb +248 -0
  112. data/lib/oraclebmc/load_balancer/models/create_backend_set_details.rb +210 -0
  113. data/lib/oraclebmc/load_balancer/models/create_certificate_details.rb +245 -0
  114. data/lib/oraclebmc/load_balancer/models/create_listener_details.rb +216 -0
  115. data/lib/oraclebmc/load_balancer/models/create_load_balancer_details.rb +233 -0
  116. data/lib/oraclebmc/load_balancer/models/health_checker.rb +265 -0
  117. data/lib/oraclebmc/load_balancer/models/health_checker_details.rb +264 -0
  118. data/lib/oraclebmc/load_balancer/models/ip_address.rb +165 -0
  119. data/lib/oraclebmc/load_balancer/models/listener.rb +216 -0
  120. data/lib/oraclebmc/load_balancer/models/listener_details.rb +202 -0
  121. data/lib/oraclebmc/load_balancer/models/load_balancer.rb +296 -0
  122. data/lib/oraclebmc/load_balancer/models/load_balancer_policy.rb +162 -0
  123. data/lib/oraclebmc/load_balancer/models/load_balancer_protocol.rb +162 -0
  124. data/lib/oraclebmc/load_balancer/models/load_balancer_shape.rb +162 -0
  125. data/lib/oraclebmc/load_balancer/models/ssl_configuration.rb +195 -0
  126. data/lib/oraclebmc/load_balancer/models/ssl_configuration_details.rb +195 -0
  127. data/lib/oraclebmc/load_balancer/models/update_backend_details.rb +220 -0
  128. data/lib/oraclebmc/load_balancer/models/update_backend_set_details.rb +197 -0
  129. data/lib/oraclebmc/load_balancer/models/update_health_checker_details.rb +263 -0
  130. data/lib/oraclebmc/load_balancer/models/update_listener_details.rb +202 -0
  131. data/lib/oraclebmc/load_balancer/models/update_load_balancer_details.rb +165 -0
  132. data/lib/oraclebmc/load_balancer/models/work_request.rb +269 -0
  133. data/lib/oraclebmc/load_balancer/models/work_request_error.rb +185 -0
  134. data/lib/oraclebmc/load_balancer/util.rb +55 -0
  135. data/lib/oraclebmc/regions.rb +41 -0
  136. data/lib/oraclebmc/response.rb +86 -0
  137. data/lib/oraclebmc/signer.rb +119 -0
  138. data/lib/oraclebmc/version.rb +5 -0
  139. data/lib/oraclebmc/waiter.rb +111 -0
  140. data/lib/oraclebmc.rb +20 -0
  141. metadata +265 -0
@@ -0,0 +1,249 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::Volume
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_PROVISIONING = 'PROVISIONING',
9
+ LIFECYCLE_STATE_RESTORING = 'RESTORING',
10
+ LIFECYCLE_STATE_AVAILABLE = 'AVAILABLE',
11
+ LIFECYCLE_STATE_TERMINATING = 'TERMINATING',
12
+ LIFECYCLE_STATE_TERMINATED = 'TERMINATED',
13
+ LIFECYCLE_STATE_FAULTY = 'FAULTY']
14
+
15
+ # The Availability Domain of the volume.
16
+ #
17
+ # Example: `Uocm:PHX-AD-1`
18
+ #
19
+ # @return [String]
20
+ attr_accessor :availability_domain
21
+
22
+ # The OCID of the compartment that contains the volume.
23
+ # @return [String]
24
+ attr_accessor :compartment_id
25
+
26
+ # A user-friendly name. Does not have to be unique, and it's changeable.
27
+ #
28
+ # @return [String]
29
+ attr_accessor :display_name
30
+
31
+ # The volume's Oracle ID (OCID).
32
+ # @return [String]
33
+ attr_accessor :id
34
+
35
+ # The current state of a volume.
36
+ # @return [String]
37
+ attr_accessor :lifecycle_state
38
+
39
+ # The size of the volume in MBs.
40
+ # @return [Integer]
41
+ attr_accessor :size_in_m_bs
42
+
43
+ # The date and time the volume was created. Format defined by RFC3339.
44
+ # @return [DateTime]
45
+ attr_accessor :time_created
46
+
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ return unless attributes.is_a?(Hash)
52
+
53
+ # convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
55
+
56
+
57
+ if attributes[:'availabilityDomain']
58
+ self.availability_domain = attributes[:'availabilityDomain']
59
+ end
60
+
61
+ if attributes[:'compartmentId']
62
+ self.compartment_id = attributes[:'compartmentId']
63
+ end
64
+
65
+ if attributes[:'displayName']
66
+ self.display_name = attributes[:'displayName']
67
+ end
68
+
69
+ if attributes[:'id']
70
+ self.id = attributes[:'id']
71
+ end
72
+
73
+ if attributes[:'lifecycleState']
74
+ self.lifecycle_state = attributes[:'lifecycleState']
75
+ end
76
+
77
+ if attributes[:'sizeInMBs']
78
+ self.size_in_m_bs = attributes[:'sizeInMBs']
79
+ end
80
+
81
+ if attributes[:'timeCreated']
82
+ self.time_created = attributes[:'timeCreated']
83
+ end
84
+
85
+ end
86
+
87
+ # Custom attribute writer method checking allowed values (enum).
88
+ # @param [Object] lifecycle_state Object to be assigned
89
+ def lifecycle_state=(lifecycle_state)
90
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
91
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
92
+ end
93
+ @lifecycle_state = lifecycle_state
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] other_object to be compared
98
+ def ==(other_object)
99
+ return true if self.equal?(other_object)
100
+ self.class == other_object.class &&
101
+ availability_domain == other_object.availability_domain &&
102
+ compartment_id == other_object.compartment_id &&
103
+ display_name == other_object.display_name &&
104
+ id == other_object.id &&
105
+ lifecycle_state == other_object.lifecycle_state &&
106
+ size_in_m_bs == other_object.size_in_m_bs &&
107
+ time_created == other_object.time_created
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] other_object to be compared
112
+ def eql?(other_object)
113
+ self == other_object
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Fixnum] Hash code
118
+ def hash
119
+ [availability_domain, compartment_id, display_name, id, lifecycle_state, size_in_m_bs, time_created].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.swagger_types.each_pair do |key, type|
128
+ if type =~ /^Array<(.*)>/i
129
+ # check to ensure the input is an array given that the the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Returns the string representation of the object
143
+ # @return [String] String presentation of the object
144
+ def to_s
145
+ to_hash.to_s
146
+ end
147
+
148
+ # Returns the object in the form of hash
149
+ # @return [Hash] Returns the object in the form of hash
150
+ def to_hash
151
+ hash = {}
152
+ self.class.attribute_map.each_pair do |attr, param|
153
+ value = self.send(attr)
154
+ next if value.nil?
155
+ hash[param] = _to_hash(value)
156
+ end
157
+ hash
158
+ end
159
+
160
+ private
161
+
162
+ # Outputs non-array value in the form of hash
163
+ # For object, use to_hash. Otherwise, just return the value
164
+ # @param [Object] value Any valid value
165
+ # @return [Hash] Returns the value in the form of hash
166
+ def _to_hash(value)
167
+ if value.is_a?(Array)
168
+ value.compact.map{ |v| _to_hash(v) }
169
+ elsif value.is_a?(Hash)
170
+ {}.tap do |hash|
171
+ value.each { |k, v| hash[k] = _to_hash(v) }
172
+ end
173
+ elsif value.respond_to? :to_hash
174
+ value.to_hash
175
+ else
176
+ value
177
+ end
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param [String] type Data type
182
+ # @param [String] value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ DateTime.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :BOOLEAN
197
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ temp_model = OracleBMC.const_get(type.to_s).new
218
+ temp_model.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+
223
+ # Attribute mapping from ruby-style variable name to JSON key.
224
+ def self.attribute_map
225
+ {
226
+ :'availability_domain' => :'availabilityDomain',
227
+ :'compartment_id' => :'compartmentId',
228
+ :'display_name' => :'displayName',
229
+ :'id' => :'id',
230
+ :'lifecycle_state' => :'lifecycleState',
231
+ :'size_in_m_bs' => :'sizeInMBs',
232
+ :'time_created' => :'timeCreated'
233
+ }
234
+ end
235
+
236
+ # Attribute type mapping.
237
+ def self.swagger_types
238
+ {
239
+ :'availability_domain' => :'String',
240
+ :'compartment_id' => :'String',
241
+ :'display_name' => :'String',
242
+ :'id' => :'String',
243
+ :'lifecycle_state' => :'String',
244
+ :'size_in_m_bs' => :'Integer',
245
+ :'time_created' => :'DateTime'
246
+ }
247
+ end
248
+ end
249
+ end
@@ -0,0 +1,284 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::VolumeAttachment
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_ATTACHING = 'ATTACHING',
9
+ LIFECYCLE_STATE_ATTACHED = 'ATTACHED',
10
+ LIFECYCLE_STATE_DETACHING = 'DETACHING',
11
+ LIFECYCLE_STATE_DETACHED = 'DETACHED']
12
+
13
+ # The type of volume attachment.
14
+ # @return [String]
15
+ attr_accessor :attachment_type
16
+
17
+ # The Availability Domain of an instance.
18
+ #
19
+ # Example: `Uocm:PHX-AD-1`
20
+ #
21
+ # @return [String]
22
+ attr_accessor :availability_domain
23
+
24
+ # The OCID of the compartment.
25
+ # @return [String]
26
+ attr_accessor :compartment_id
27
+
28
+ # A user-friendly name. Does not have to be unique, and it cannot be changed.
29
+ #
30
+ # Example: `My volume attachment`
31
+ #
32
+ # @return [String]
33
+ attr_accessor :display_name
34
+
35
+ # The OCID of the volume attachment.
36
+ # @return [String]
37
+ attr_accessor :id
38
+
39
+ # The OCID of the instance the volume is attached to.
40
+ # @return [String]
41
+ attr_accessor :instance_id
42
+
43
+ # The current state of the volume attachment.
44
+ # @return [String]
45
+ attr_accessor :lifecycle_state
46
+
47
+ # The date and time the volume was created, in the format defined by RFC3339.
48
+ #
49
+ # Example: `2016-08-25T21:10:29.600Z`
50
+ #
51
+ # @return [DateTime]
52
+ attr_accessor :time_created
53
+
54
+ # The OCID of the volume.
55
+ # @return [String]
56
+ attr_accessor :volume_id
57
+
58
+
59
+ # Given the hash representation of a subtype of this class,
60
+ # use the info in the hash to return the class of the subtype.
61
+ def self.get_subtype(object_hash)
62
+ type = object_hash[:'attachmentType']
63
+
64
+ return 'OracleBMC::Core::Models::IScsiVolumeAttachment' if not type or type == 'iscsi'
65
+
66
+ fail 'Could not resolve subtype type based on the object hash.'
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ return unless attributes.is_a?(Hash)
73
+
74
+ # convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
76
+
77
+
78
+ if attributes[:'attachmentType']
79
+ self.attachment_type = attributes[:'attachmentType']
80
+ end
81
+
82
+ if attributes[:'availabilityDomain']
83
+ self.availability_domain = attributes[:'availabilityDomain']
84
+ end
85
+
86
+ if attributes[:'compartmentId']
87
+ self.compartment_id = attributes[:'compartmentId']
88
+ end
89
+
90
+ if attributes[:'displayName']
91
+ self.display_name = attributes[:'displayName']
92
+ end
93
+
94
+ if attributes[:'id']
95
+ self.id = attributes[:'id']
96
+ end
97
+
98
+ if attributes[:'instanceId']
99
+ self.instance_id = attributes[:'instanceId']
100
+ end
101
+
102
+ if attributes[:'lifecycleState']
103
+ self.lifecycle_state = attributes[:'lifecycleState']
104
+ end
105
+
106
+ if attributes[:'timeCreated']
107
+ self.time_created = attributes[:'timeCreated']
108
+ end
109
+
110
+ if attributes[:'volumeId']
111
+ self.volume_id = attributes[:'volumeId']
112
+ end
113
+
114
+ end
115
+
116
+ # Custom attribute writer method checking allowed values (enum).
117
+ # @param [Object] lifecycle_state Object to be assigned
118
+ def lifecycle_state=(lifecycle_state)
119
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
120
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
121
+ end
122
+ @lifecycle_state = lifecycle_state
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] other_object to be compared
127
+ def ==(other_object)
128
+ return true if self.equal?(other_object)
129
+ self.class == other_object.class &&
130
+ attachment_type == other_object.attachment_type &&
131
+ availability_domain == other_object.availability_domain &&
132
+ compartment_id == other_object.compartment_id &&
133
+ display_name == other_object.display_name &&
134
+ id == other_object.id &&
135
+ instance_id == other_object.instance_id &&
136
+ lifecycle_state == other_object.lifecycle_state &&
137
+ time_created == other_object.time_created &&
138
+ volume_id == other_object.volume_id
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] other_object to be compared
143
+ def eql?(other_object)
144
+ self == other_object
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Fixnum] Hash code
149
+ def hash
150
+ [attachment_type, availability_domain, compartment_id, display_name, id, instance_id, lifecycle_state, time_created, volume_id].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.swagger_types.each_pair do |key, type|
159
+ if type =~ /^Array<(.*)>/i
160
+ # check to ensure the input is an array given that the the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
163
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
164
+ end
165
+ elsif !attributes[self.class.attribute_map[key]].nil?
166
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ next if value.nil?
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ private
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map{ |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param [String] type Data type
213
+ # @param [String] value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :DateTime
218
+ DateTime.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :BOOLEAN
228
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ temp_model = OracleBMC.const_get(type.to_s).new
249
+ temp_model.build_from_hash(value)
250
+ end
251
+ end
252
+
253
+
254
+ # Attribute mapping from ruby-style variable name to JSON key.
255
+ def self.attribute_map
256
+ {
257
+ :'attachment_type' => :'attachmentType',
258
+ :'availability_domain' => :'availabilityDomain',
259
+ :'compartment_id' => :'compartmentId',
260
+ :'display_name' => :'displayName',
261
+ :'id' => :'id',
262
+ :'instance_id' => :'instanceId',
263
+ :'lifecycle_state' => :'lifecycleState',
264
+ :'time_created' => :'timeCreated',
265
+ :'volume_id' => :'volumeId'
266
+ }
267
+ end
268
+
269
+ # Attribute type mapping.
270
+ def self.swagger_types
271
+ {
272
+ :'attachment_type' => :'String',
273
+ :'availability_domain' => :'String',
274
+ :'compartment_id' => :'String',
275
+ :'display_name' => :'String',
276
+ :'id' => :'String',
277
+ :'instance_id' => :'String',
278
+ :'lifecycle_state' => :'String',
279
+ :'time_created' => :'DateTime',
280
+ :'volume_id' => :'String'
281
+ }
282
+ end
283
+ end
284
+ end