oci 2.0.0

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 (217) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +82 -0
  3. data/README.md +262 -0
  4. data/lib/oci.rb +25 -0
  5. data/lib/oci/api_client.rb +389 -0
  6. data/lib/oci/config.rb +118 -0
  7. data/lib/oci/config_file_loader.rb +96 -0
  8. data/lib/oci/core/blockstorage_client.rb +462 -0
  9. data/lib/oci/core/compute_client.rb +1415 -0
  10. data/lib/oci/core/core.rb +114 -0
  11. data/lib/oci/core/models/attach_i_scsi_volume_details.rb +137 -0
  12. data/lib/oci/core/models/attach_vnic_details.rb +144 -0
  13. data/lib/oci/core/models/attach_volume_details.rb +165 -0
  14. data/lib/oci/core/models/capture_console_history_details.rb +120 -0
  15. data/lib/oci/core/models/console_history.rb +213 -0
  16. data/lib/oci/core/models/cpe.rb +169 -0
  17. data/lib/oci/core/models/create_cpe_details.rb +145 -0
  18. data/lib/oci/core/models/create_cross_connect_details.rb +204 -0
  19. data/lib/oci/core/models/create_cross_connect_group_details.rb +133 -0
  20. data/lib/oci/core/models/create_dhcp_details.rb +153 -0
  21. data/lib/oci/core/models/create_drg_attachment_details.rb +142 -0
  22. data/lib/oci/core/models/create_drg_details.rb +131 -0
  23. data/lib/oci/core/models/create_image_details.rb +159 -0
  24. data/lib/oci/core/models/create_instance_console_connection_details.rb +131 -0
  25. data/lib/oci/core/models/create_internet_gateway_details.rb +153 -0
  26. data/lib/oci/core/models/create_ip_sec_connection_details.rb +168 -0
  27. data/lib/oci/core/models/create_private_ip_details.rb +173 -0
  28. data/lib/oci/core/models/create_route_table_details.rb +153 -0
  29. data/lib/oci/core/models/create_security_list_details.rb +164 -0
  30. data/lib/oci/core/models/create_subnet_details.rb +257 -0
  31. data/lib/oci/core/models/create_vcn_details.rb +171 -0
  32. data/lib/oci/core/models/create_virtual_circuit_details.rb +260 -0
  33. data/lib/oci/core/models/create_vnic_details.rb +214 -0
  34. data/lib/oci/core/models/create_volume_backup_details.rb +133 -0
  35. data/lib/oci/core/models/create_volume_details.rb +170 -0
  36. data/lib/oci/core/models/cross_connect.rb +235 -0
  37. data/lib/oci/core/models/cross_connect_group.rb +187 -0
  38. data/lib/oci/core/models/cross_connect_location.rb +134 -0
  39. data/lib/oci/core/models/cross_connect_mapping.rb +190 -0
  40. data/lib/oci/core/models/cross_connect_port_speed_shape.rb +137 -0
  41. data/lib/oci/core/models/cross_connect_status.rb +200 -0
  42. data/lib/oci/core/models/dhcp_dns_option.rb +171 -0
  43. data/lib/oci/core/models/dhcp_option.rb +135 -0
  44. data/lib/oci/core/models/dhcp_options.rb +208 -0
  45. data/lib/oci/core/models/dhcp_search_domain_option.rb +141 -0
  46. data/lib/oci/core/models/drg.rb +186 -0
  47. data/lib/oci/core/models/drg_attachment.rb +208 -0
  48. data/lib/oci/core/models/egress_security_rule.rb +198 -0
  49. data/lib/oci/core/models/export_image_details.rb +134 -0
  50. data/lib/oci/core/models/export_image_via_object_storage_tuple_details.rb +150 -0
  51. data/lib/oci/core/models/export_image_via_object_storage_uri_details.rb +130 -0
  52. data/lib/oci/core/models/fast_connect_provider_service.rb +145 -0
  53. data/lib/oci/core/models/i_scsi_volume_attachment.rb +212 -0
  54. data/lib/oci/core/models/icmp_options.rb +131 -0
  55. data/lib/oci/core/models/image.rb +245 -0
  56. data/lib/oci/core/models/image_source_details.rb +134 -0
  57. data/lib/oci/core/models/image_source_via_object_storage_tuple_details.rb +150 -0
  58. data/lib/oci/core/models/image_source_via_object_storage_uri_details.rb +128 -0
  59. data/lib/oci/core/models/ingress_security_rule.rb +198 -0
  60. data/lib/oci/core/models/instance.rb +307 -0
  61. data/lib/oci/core/models/instance_console_connection.rb +193 -0
  62. data/lib/oci/core/models/instance_credentials.rb +131 -0
  63. data/lib/oci/core/models/internet_gateway.rb +210 -0
  64. data/lib/oci/core/models/ip_sec_connection.rb +223 -0
  65. data/lib/oci/core/models/ip_sec_connection_device_config.rb +153 -0
  66. data/lib/oci/core/models/ip_sec_connection_device_status.rb +156 -0
  67. data/lib/oci/core/models/launch_instance_details.rb +336 -0
  68. data/lib/oci/core/models/letter_of_authority.rb +194 -0
  69. data/lib/oci/core/models/port_range.rb +133 -0
  70. data/lib/oci/core/models/private_ip.rb +248 -0
  71. data/lib/oci/core/models/route_rule.rb +135 -0
  72. data/lib/oci/core/models/route_table.rb +208 -0
  73. data/lib/oci/core/models/security_list.rb +219 -0
  74. data/lib/oci/core/models/shape.rb +122 -0
  75. data/lib/oci/core/models/subnet.rb +351 -0
  76. data/lib/oci/core/models/tcp_options.rb +135 -0
  77. data/lib/oci/core/models/tunnel_config.rb +151 -0
  78. data/lib/oci/core/models/tunnel_status.rb +178 -0
  79. data/lib/oci/core/models/udp_options.rb +135 -0
  80. data/lib/oci/core/models/update_cpe_details.rb +122 -0
  81. data/lib/oci/core/models/update_cross_connect_details.rb +138 -0
  82. data/lib/oci/core/models/update_cross_connect_group_details.rb +122 -0
  83. data/lib/oci/core/models/update_dhcp_details.rb +132 -0
  84. data/lib/oci/core/models/update_drg_attachment_details.rb +122 -0
  85. data/lib/oci/core/models/update_drg_details.rb +122 -0
  86. data/lib/oci/core/models/update_image_details.rb +124 -0
  87. data/lib/oci/core/models/update_instance_details.rb +124 -0
  88. data/lib/oci/core/models/update_internet_gateway_details.rb +133 -0
  89. data/lib/oci/core/models/update_ip_sec_connection_details.rb +122 -0
  90. data/lib/oci/core/models/update_private_ip_details.rb +157 -0
  91. data/lib/oci/core/models/update_route_table_details.rb +133 -0
  92. data/lib/oci/core/models/update_security_list_details.rb +144 -0
  93. data/lib/oci/core/models/update_subnet_details.rb +122 -0
  94. data/lib/oci/core/models/update_vcn_details.rb +122 -0
  95. data/lib/oci/core/models/update_virtual_circuit_details.rb +240 -0
  96. data/lib/oci/core/models/update_vnic_details.rb +144 -0
  97. data/lib/oci/core/models/update_volume_backup_details.rb +122 -0
  98. data/lib/oci/core/models/update_volume_details.rb +122 -0
  99. data/lib/oci/core/models/vcn.rb +276 -0
  100. data/lib/oci/core/models/virtual_circuit.rb +395 -0
  101. data/lib/oci/core/models/virtual_circuit_bandwidth_shape.rb +137 -0
  102. data/lib/oci/core/models/vnic.rb +287 -0
  103. data/lib/oci/core/models/vnic_attachment.rb +250 -0
  104. data/lib/oci/core/models/volume.rb +210 -0
  105. data/lib/oci/core/models/volume_attachment.rb +246 -0
  106. data/lib/oci/core/models/volume_backup.rb +235 -0
  107. data/lib/oci/core/util.rb +1 -0
  108. data/lib/oci/core/virtual_network_client.rb +3421 -0
  109. data/lib/oci/errors.rb +78 -0
  110. data/lib/oci/global_context.rb +20 -0
  111. data/lib/oci/identity/identity.rb +55 -0
  112. data/lib/oci/identity/identity_client.rb +2148 -0
  113. data/lib/oci/identity/models/add_user_to_group_details.rb +131 -0
  114. data/lib/oci/identity/models/api_key.rb +211 -0
  115. data/lib/oci/identity/models/availability_domain.rb +131 -0
  116. data/lib/oci/identity/models/compartment.rb +211 -0
  117. data/lib/oci/identity/models/create_api_key_details.rb +120 -0
  118. data/lib/oci/identity/models/create_compartment_details.rb +145 -0
  119. data/lib/oci/identity/models/create_customer_secret_key_details.rb +121 -0
  120. data/lib/oci/identity/models/create_group_details.rb +144 -0
  121. data/lib/oci/identity/models/create_identity_provider_details.rb +215 -0
  122. data/lib/oci/identity/models/create_idp_group_mapping_details.rb +133 -0
  123. data/lib/oci/identity/models/create_policy_details.rb +173 -0
  124. data/lib/oci/identity/models/create_region_subscription_details.rb +128 -0
  125. data/lib/oci/identity/models/create_saml2_identity_provider_details.rb +154 -0
  126. data/lib/oci/identity/models/create_swift_password_details.rb +121 -0
  127. data/lib/oci/identity/models/create_user_details.rb +144 -0
  128. data/lib/oci/identity/models/customer_secret_key.rb +225 -0
  129. data/lib/oci/identity/models/customer_secret_key_summary.rb +213 -0
  130. data/lib/oci/identity/models/group.rb +211 -0
  131. data/lib/oci/identity/models/identity_provider.rb +261 -0
  132. data/lib/oci/identity/models/idp_group_mapping.rb +220 -0
  133. data/lib/oci/identity/models/policy.rb +237 -0
  134. data/lib/oci/identity/models/region.rb +143 -0
  135. data/lib/oci/identity/models/region_subscription.rb +180 -0
  136. data/lib/oci/identity/models/saml2_identity_provider.rb +180 -0
  137. data/lib/oci/identity/models/swift_password.rb +226 -0
  138. data/lib/oci/identity/models/tenancy.rb +159 -0
  139. data/lib/oci/identity/models/ui_password.rb +187 -0
  140. data/lib/oci/identity/models/update_compartment_details.rb +132 -0
  141. data/lib/oci/identity/models/update_customer_secret_key_details.rb +120 -0
  142. data/lib/oci/identity/models/update_group_details.rb +120 -0
  143. data/lib/oci/identity/models/update_identity_provider_details.rb +160 -0
  144. data/lib/oci/identity/models/update_idp_group_mapping_details.rb +131 -0
  145. data/lib/oci/identity/models/update_policy_details.rb +148 -0
  146. data/lib/oci/identity/models/update_saml2_identity_provider_details.rb +145 -0
  147. data/lib/oci/identity/models/update_state_details.rb +121 -0
  148. data/lib/oci/identity/models/update_swift_password_details.rb +120 -0
  149. data/lib/oci/identity/models/update_user_details.rb +120 -0
  150. data/lib/oci/identity/models/user.rb +217 -0
  151. data/lib/oci/identity/models/user_group_membership.rb +209 -0
  152. data/lib/oci/identity/util.rb +1 -0
  153. data/lib/oci/internal/internal.rb +10 -0
  154. data/lib/oci/internal/util.rb +69 -0
  155. data/lib/oci/load_balancer/load_balancer.rb +51 -0
  156. data/lib/oci/load_balancer/load_balancer_client.rb +1449 -0
  157. data/lib/oci/load_balancer/models/backend.rb +220 -0
  158. data/lib/oci/load_balancer/models/backend_details.rb +206 -0
  159. data/lib/oci/load_balancer/models/backend_health.rb +158 -0
  160. data/lib/oci/load_balancer/models/backend_set.rb +182 -0
  161. data/lib/oci/load_balancer/models/backend_set_details.rb +165 -0
  162. data/lib/oci/load_balancer/models/backend_set_health.rb +207 -0
  163. data/lib/oci/load_balancer/models/certificate.rb +169 -0
  164. data/lib/oci/load_balancer/models/certificate_details.rb +205 -0
  165. data/lib/oci/load_balancer/models/create_backend_details.rb +206 -0
  166. data/lib/oci/load_balancer/models/create_backend_set_details.rb +181 -0
  167. data/lib/oci/load_balancer/models/create_certificate_details.rb +205 -0
  168. data/lib/oci/load_balancer/models/create_listener_details.rb +175 -0
  169. data/lib/oci/load_balancer/models/create_load_balancer_details.rb +220 -0
  170. data/lib/oci/load_balancer/models/health_check_result.rb +183 -0
  171. data/lib/oci/load_balancer/models/health_checker.rb +224 -0
  172. data/lib/oci/load_balancer/models/health_checker_details.rb +223 -0
  173. data/lib/oci/load_balancer/models/ip_address.rb +139 -0
  174. data/lib/oci/load_balancer/models/listener.rb +174 -0
  175. data/lib/oci/load_balancer/models/listener_details.rb +160 -0
  176. data/lib/oci/load_balancer/models/load_balancer.rb +280 -0
  177. data/lib/oci/load_balancer/models/load_balancer_health.rb +215 -0
  178. data/lib/oci/load_balancer/models/load_balancer_health_summary.rb +168 -0
  179. data/lib/oci/load_balancer/models/load_balancer_policy.rb +120 -0
  180. data/lib/oci/load_balancer/models/load_balancer_protocol.rb +120 -0
  181. data/lib/oci/load_balancer/models/load_balancer_shape.rb +120 -0
  182. data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +141 -0
  183. data/lib/oci/load_balancer/models/ssl_configuration.rb +155 -0
  184. data/lib/oci/load_balancer/models/ssl_configuration_details.rb +155 -0
  185. data/lib/oci/load_balancer/models/update_backend_details.rb +178 -0
  186. data/lib/oci/load_balancer/models/update_backend_set_details.rb +165 -0
  187. data/lib/oci/load_balancer/models/update_health_checker_details.rb +222 -0
  188. data/lib/oci/load_balancer/models/update_listener_details.rb +160 -0
  189. data/lib/oci/load_balancer/models/update_load_balancer_details.rb +124 -0
  190. data/lib/oci/load_balancer/models/work_request.rb +229 -0
  191. data/lib/oci/load_balancer/models/work_request_error.rb +145 -0
  192. data/lib/oci/load_balancer/util.rb +58 -0
  193. data/lib/oci/object_storage/models/bucket.rb +216 -0
  194. data/lib/oci/object_storage/models/bucket_summary.rb +175 -0
  195. data/lib/oci/object_storage/models/commit_multipart_upload_details.rb +133 -0
  196. data/lib/oci/object_storage/models/commit_multipart_upload_part_details.rb +131 -0
  197. data/lib/oci/object_storage/models/create_bucket_details.rb +173 -0
  198. data/lib/oci/object_storage/models/create_multipart_upload_details.rb +166 -0
  199. data/lib/oci/object_storage/models/create_preauthenticated_request_details.rb +171 -0
  200. data/lib/oci/object_storage/models/list_objects.rb +146 -0
  201. data/lib/oci/object_storage/models/multipart_upload.rb +164 -0
  202. data/lib/oci/object_storage/models/multipart_upload_part_summary.rb +153 -0
  203. data/lib/oci/object_storage/models/object_summary.rb +153 -0
  204. data/lib/oci/object_storage/models/preauthenticated_request.rb +207 -0
  205. data/lib/oci/object_storage/models/preauthenticated_request_summary.rb +196 -0
  206. data/lib/oci/object_storage/models/update_bucket_details.rb +171 -0
  207. data/lib/oci/object_storage/object_storage.rb +30 -0
  208. data/lib/oci/object_storage/object_storage_client.rb +1185 -0
  209. data/lib/oci/object_storage/util.rb +1 -0
  210. data/lib/oci/regions.rb +43 -0
  211. data/lib/oci/response.rb +80 -0
  212. data/lib/oci/response_headers.rb +144 -0
  213. data/lib/oci/signer.rb +157 -0
  214. data/lib/oci/version.rb +5 -0
  215. data/lib/oci/waiter.rb +101 -0
  216. data/lib/oraclebmc.rb +3 -0
  217. metadata +375 -0
@@ -0,0 +1,210 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
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
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']
15
+
16
+ # The Availability Domain of the volume.
17
+ #
18
+ # Example: `Uocm:PHX-AD-1`
19
+ #
20
+ # @return [String]
21
+ attr_accessor :availability_domain
22
+
23
+ # The OCID of the compartment that contains the volume.
24
+ # @return [String]
25
+ attr_accessor :compartment_id
26
+
27
+ # A user-friendly name. Does not have to be unique, and it's changeable.
28
+ # Avoid entering confidential information.
29
+ #
30
+ # @return [String]
31
+ attr_accessor :display_name
32
+
33
+ # The volume's Oracle ID (OCID).
34
+ # @return [String]
35
+ attr_accessor :id
36
+
37
+ # The current state of a volume.
38
+ # @return [String]
39
+ attr_accessor :lifecycle_state
40
+
41
+ # The size of the volume in MBs. The value must be a multiple of 1024.
42
+ # @return [Integer]
43
+ attr_accessor :size_in_mbs
44
+
45
+ # The date and time the volume was created. Format defined by RFC3339.
46
+ # @return [DateTime]
47
+ attr_accessor :time_created
48
+
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
57
+
58
+ if attributes[:'availabilityDomain']
59
+ self.availability_domain = attributes[:'availabilityDomain']
60
+ end
61
+
62
+ if attributes[:'compartmentId']
63
+ self.compartment_id = attributes[:'compartmentId']
64
+ end
65
+
66
+ if attributes[:'displayName']
67
+ self.display_name = attributes[:'displayName']
68
+ end
69
+
70
+ if attributes[:'id']
71
+ self.id = attributes[:'id']
72
+ end
73
+
74
+ if attributes[:'lifecycleState']
75
+ self.lifecycle_state = attributes[:'lifecycleState']
76
+ end
77
+
78
+ if attributes[:'sizeInMBs']
79
+ self.size_in_mbs = attributes[:'sizeInMBs']
80
+ end
81
+
82
+ if attributes[:'timeCreated']
83
+ self.time_created = attributes[:'timeCreated']
84
+ end
85
+
86
+ end
87
+
88
+ # Custom attribute writer method checking allowed values (enum).
89
+ # @param [Object] lifecycle_state Object to be assigned
90
+ def lifecycle_state=(lifecycle_state)
91
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
92
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
93
+ else
94
+ @lifecycle_state = lifecycle_state
95
+ end
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] other_object to be compared
100
+ def ==(other_object)
101
+ return true if self.equal?(other_object)
102
+ self.class == other_object.class &&
103
+ availability_domain == other_object.availability_domain &&
104
+ compartment_id == other_object.compartment_id &&
105
+ display_name == other_object.display_name &&
106
+ id == other_object.id &&
107
+ lifecycle_state == other_object.lifecycle_state &&
108
+ size_in_mbs == other_object.size_in_mbs &&
109
+ time_created == other_object.time_created
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] other_object to be compared
114
+ def eql?(other_object)
115
+ self == other_object
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [availability_domain, compartment_id, display_name, id, lifecycle_state, size_in_mbs, time_created].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.swagger_types.each_pair do |key, type|
130
+ if type =~ /^Array<(.*)>/i
131
+ # check to ensure the input is an array given that the the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # Returns the object in the form of hash
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_hash
153
+ hash = {}
154
+ self.class.attribute_map.each_pair do |attr, param|
155
+ value = self.send(attr)
156
+ next if value.nil?
157
+ hash[param] = _to_hash(value)
158
+ end
159
+ hash
160
+ end
161
+
162
+ private
163
+
164
+ # Outputs non-array value in the form of hash
165
+ # For object, use to_hash. Otherwise, just return the value
166
+ # @param [Object] value Any valid value
167
+ # @return [Hash] Returns the value in the form of hash
168
+ def _to_hash(value)
169
+ if value.is_a?(Array)
170
+ value.compact.map{ |v| _to_hash(v) }
171
+ elsif value.is_a?(Hash)
172
+ {}.tap do |hash|
173
+ value.each { |k, v| hash[k] = _to_hash(v) }
174
+ end
175
+ elsif value.respond_to? :to_hash
176
+ value.to_hash
177
+ else
178
+ value
179
+ end
180
+ end
181
+
182
+
183
+
184
+ # Attribute mapping from ruby-style variable name to JSON key.
185
+ def self.attribute_map
186
+ {
187
+ :'availability_domain' => :'availabilityDomain',
188
+ :'compartment_id' => :'compartmentId',
189
+ :'display_name' => :'displayName',
190
+ :'id' => :'id',
191
+ :'lifecycle_state' => :'lifecycleState',
192
+ :'size_in_mbs' => :'sizeInMBs',
193
+ :'time_created' => :'timeCreated'
194
+ }
195
+ end
196
+
197
+ # Attribute type mapping.
198
+ def self.swagger_types
199
+ {
200
+ :'availability_domain' => :'String',
201
+ :'compartment_id' => :'String',
202
+ :'display_name' => :'String',
203
+ :'id' => :'String',
204
+ :'lifecycle_state' => :'String',
205
+ :'size_in_mbs' => :'Integer',
206
+ :'time_created' => :'DateTime'
207
+ }
208
+ end
209
+ end
210
+ end
@@ -0,0 +1,246 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
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
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']
13
+
14
+ # The type of volume attachment.
15
+ # @return [String]
16
+ attr_accessor :attachment_type
17
+
18
+ # The Availability Domain of an instance.
19
+ #
20
+ # Example: `Uocm:PHX-AD-1`
21
+ #
22
+ # @return [String]
23
+ attr_accessor :availability_domain
24
+
25
+ # The OCID of the compartment.
26
+ # @return [String]
27
+ attr_accessor :compartment_id
28
+
29
+ # A user-friendly name. Does not have to be unique, and it cannot be changed.
30
+ # Avoid entering confidential information.
31
+ #
32
+ # Example: `My volume attachment`
33
+ #
34
+ # @return [String]
35
+ attr_accessor :display_name
36
+
37
+ # The OCID of the volume attachment.
38
+ # @return [String]
39
+ attr_accessor :id
40
+
41
+ # The OCID of the instance the volume is attached to.
42
+ # @return [String]
43
+ attr_accessor :instance_id
44
+
45
+ # The current state of the volume attachment.
46
+ # @return [String]
47
+ attr_accessor :lifecycle_state
48
+
49
+ # The date and time the volume was created, in the format defined by RFC3339.
50
+ #
51
+ # Example: `2016-08-25T21:10:29.600Z`
52
+ #
53
+ # @return [DateTime]
54
+ attr_accessor :time_created
55
+
56
+ # The OCID of the volume.
57
+ # @return [String]
58
+ attr_accessor :volume_id
59
+
60
+
61
+ # Given the hash representation of a subtype of this class,
62
+ # use the info in the hash to return the class of the subtype.
63
+ def self.get_subtype(object_hash)
64
+ type = object_hash[:'attachmentType']
65
+
66
+ return 'OCI::Core::Models::IScsiVolumeAttachment' if type == 'iscsi'
67
+
68
+ # TODO: Log a warning when the subtype is not found.
69
+ return 'OCI::Core::Models::VolumeAttachment'
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ return unless attributes.is_a?(Hash)
76
+
77
+ # convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
79
+
80
+ if attributes[:'attachmentType']
81
+ self.attachment_type = attributes[:'attachmentType']
82
+ end
83
+
84
+ if attributes[:'availabilityDomain']
85
+ self.availability_domain = attributes[:'availabilityDomain']
86
+ end
87
+
88
+ if attributes[:'compartmentId']
89
+ self.compartment_id = attributes[:'compartmentId']
90
+ end
91
+
92
+ if attributes[:'displayName']
93
+ self.display_name = attributes[:'displayName']
94
+ end
95
+
96
+ if attributes[:'id']
97
+ self.id = attributes[:'id']
98
+ end
99
+
100
+ if attributes[:'instanceId']
101
+ self.instance_id = attributes[:'instanceId']
102
+ end
103
+
104
+ if attributes[:'lifecycleState']
105
+ self.lifecycle_state = attributes[:'lifecycleState']
106
+ end
107
+
108
+ if attributes[:'timeCreated']
109
+ self.time_created = attributes[:'timeCreated']
110
+ end
111
+
112
+ if attributes[:'volumeId']
113
+ self.volume_id = attributes[:'volumeId']
114
+ end
115
+
116
+ end
117
+
118
+ # Custom attribute writer method checking allowed values (enum).
119
+ # @param [Object] lifecycle_state Object to be assigned
120
+ def lifecycle_state=(lifecycle_state)
121
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
122
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
123
+ else
124
+ @lifecycle_state = lifecycle_state
125
+ end
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] other_object to be compared
130
+ def ==(other_object)
131
+ return true if self.equal?(other_object)
132
+ self.class == other_object.class &&
133
+ attachment_type == other_object.attachment_type &&
134
+ availability_domain == other_object.availability_domain &&
135
+ compartment_id == other_object.compartment_id &&
136
+ display_name == other_object.display_name &&
137
+ id == other_object.id &&
138
+ instance_id == other_object.instance_id &&
139
+ lifecycle_state == other_object.lifecycle_state &&
140
+ time_created == other_object.time_created &&
141
+ volume_id == other_object.volume_id
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] other_object to be compared
146
+ def eql?(other_object)
147
+ self == other_object
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Fixnum] Hash code
152
+ def hash
153
+ [attachment_type, availability_domain, compartment_id, display_name, id, instance_id, lifecycle_state, time_created, volume_id].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ self.class.swagger_types.each_pair do |key, type|
162
+ if type =~ /^Array<(.*)>/i
163
+ # check to ensure the input is an array given that the the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
166
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
167
+ end
168
+ elsif !attributes[self.class.attribute_map[key]].nil?
169
+ self.send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
170
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
171
+ end
172
+
173
+ self
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ next if value.nil?
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ private
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map{ |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+
214
+
215
+
216
+ # Attribute mapping from ruby-style variable name to JSON key.
217
+ def self.attribute_map
218
+ {
219
+ :'attachment_type' => :'attachmentType',
220
+ :'availability_domain' => :'availabilityDomain',
221
+ :'compartment_id' => :'compartmentId',
222
+ :'display_name' => :'displayName',
223
+ :'id' => :'id',
224
+ :'instance_id' => :'instanceId',
225
+ :'lifecycle_state' => :'lifecycleState',
226
+ :'time_created' => :'timeCreated',
227
+ :'volume_id' => :'volumeId'
228
+ }
229
+ end
230
+
231
+ # Attribute type mapping.
232
+ def self.swagger_types
233
+ {
234
+ :'attachment_type' => :'String',
235
+ :'availability_domain' => :'String',
236
+ :'compartment_id' => :'String',
237
+ :'display_name' => :'String',
238
+ :'id' => :'String',
239
+ :'instance_id' => :'String',
240
+ :'lifecycle_state' => :'String',
241
+ :'time_created' => :'DateTime',
242
+ :'volume_id' => :'String'
243
+ }
244
+ end
245
+ end
246
+ end