oci 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (248) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/lib/oci.rb +2 -1
  4. data/lib/oci/audit/audit.rb +19 -0
  5. data/lib/oci/audit/audit_client.rb +176 -0
  6. data/lib/oci/audit/models/audit_event.rb +307 -0
  7. data/lib/oci/audit/models/configuration.rb +120 -0
  8. data/lib/oci/audit/models/update_configuration_details.rb +120 -0
  9. data/lib/oci/audit/util.rb +1 -0
  10. data/lib/oci/core/blockstorage_client.rb +69 -1
  11. data/lib/oci/core/compute_client.rb +106 -16
  12. data/lib/oci/core/core.rb +3 -0
  13. data/lib/oci/core/models/attach_i_scsi_volume_details.rb +2 -2
  14. data/lib/oci/core/models/attach_vnic_details.rb +2 -2
  15. data/lib/oci/core/models/attach_volume_details.rb +2 -2
  16. data/lib/oci/core/models/capture_console_history_details.rb +2 -2
  17. data/lib/oci/core/models/console_history.rb +2 -2
  18. data/lib/oci/core/models/cpe.rb +2 -2
  19. data/lib/oci/core/models/create_cpe_details.rb +2 -2
  20. data/lib/oci/core/models/create_cross_connect_details.rb +2 -2
  21. data/lib/oci/core/models/create_cross_connect_group_details.rb +2 -2
  22. data/lib/oci/core/models/create_dhcp_details.rb +2 -2
  23. data/lib/oci/core/models/create_drg_attachment_details.rb +2 -2
  24. data/lib/oci/core/models/create_drg_details.rb +2 -2
  25. data/lib/oci/core/models/create_image_details.rb +2 -2
  26. data/lib/oci/core/models/create_instance_console_connection_details.rb +2 -2
  27. data/lib/oci/core/models/create_internet_gateway_details.rb +2 -2
  28. data/lib/oci/core/models/create_ip_sec_connection_details.rb +2 -2
  29. data/lib/oci/core/models/create_private_ip_details.rb +2 -2
  30. data/lib/oci/core/models/create_route_table_details.rb +2 -2
  31. data/lib/oci/core/models/create_security_list_details.rb +2 -2
  32. data/lib/oci/core/models/create_subnet_details.rb +2 -2
  33. data/lib/oci/core/models/create_vcn_details.rb +2 -2
  34. data/lib/oci/core/models/create_virtual_circuit_details.rb +5 -6
  35. data/lib/oci/core/models/create_vnic_details.rb +2 -2
  36. data/lib/oci/core/models/create_volume_backup_details.rb +2 -2
  37. data/lib/oci/core/models/create_volume_details.rb +20 -4
  38. data/lib/oci/core/models/cross_connect.rb +2 -2
  39. data/lib/oci/core/models/cross_connect_group.rb +2 -2
  40. data/lib/oci/core/models/cross_connect_location.rb +2 -2
  41. data/lib/oci/core/models/cross_connect_mapping.rb +2 -2
  42. data/lib/oci/core/models/cross_connect_port_speed_shape.rb +2 -2
  43. data/lib/oci/core/models/cross_connect_status.rb +2 -2
  44. data/lib/oci/core/models/dhcp_dns_option.rb +2 -2
  45. data/lib/oci/core/models/dhcp_option.rb +2 -2
  46. data/lib/oci/core/models/dhcp_options.rb +2 -2
  47. data/lib/oci/core/models/dhcp_search_domain_option.rb +2 -2
  48. data/lib/oci/core/models/drg.rb +2 -2
  49. data/lib/oci/core/models/drg_attachment.rb +2 -2
  50. data/lib/oci/core/models/egress_security_rule.rb +2 -2
  51. data/lib/oci/core/models/export_image_details.rb +3 -3
  52. data/lib/oci/core/models/export_image_via_object_storage_tuple_details.rb +5 -5
  53. data/lib/oci/core/models/export_image_via_object_storage_uri_details.rb +3 -3
  54. data/lib/oci/core/models/fast_connect_provider_service.rb +2 -2
  55. data/lib/oci/core/models/i_scsi_volume_attachment.rb +2 -2
  56. data/lib/oci/core/models/icmp_options.rb +2 -2
  57. data/lib/oci/core/models/image.rb +2 -2
  58. data/lib/oci/core/models/image_source_details.rb +3 -3
  59. data/lib/oci/core/models/image_source_via_object_storage_tuple_details.rb +5 -5
  60. data/lib/oci/core/models/image_source_via_object_storage_uri_details.rb +3 -3
  61. data/lib/oci/core/models/ingress_security_rule.rb +2 -2
  62. data/lib/oci/core/models/instance.rb +4 -4
  63. data/lib/oci/core/models/instance_console_connection.rb +2 -2
  64. data/lib/oci/core/models/instance_credentials.rb +2 -2
  65. data/lib/oci/core/models/internet_gateway.rb +2 -2
  66. data/lib/oci/core/models/ip_sec_connection.rb +2 -2
  67. data/lib/oci/core/models/ip_sec_connection_device_config.rb +2 -2
  68. data/lib/oci/core/models/ip_sec_connection_device_status.rb +2 -2
  69. data/lib/oci/core/models/launch_instance_details.rb +4 -4
  70. data/lib/oci/core/models/letter_of_authority.rb +2 -2
  71. data/lib/oci/core/models/port_range.rb +2 -2
  72. data/lib/oci/core/models/private_ip.rb +2 -2
  73. data/lib/oci/core/models/route_rule.rb +2 -2
  74. data/lib/oci/core/models/route_table.rb +2 -2
  75. data/lib/oci/core/models/security_list.rb +2 -2
  76. data/lib/oci/core/models/shape.rb +2 -2
  77. data/lib/oci/core/models/subnet.rb +2 -2
  78. data/lib/oci/core/models/tcp_options.rb +2 -2
  79. data/lib/oci/core/models/tunnel_config.rb +2 -2
  80. data/lib/oci/core/models/tunnel_status.rb +2 -2
  81. data/lib/oci/core/models/udp_options.rb +2 -2
  82. data/lib/oci/core/models/update_console_history_details.rb +2 -2
  83. data/lib/oci/core/models/update_cpe_details.rb +2 -2
  84. data/lib/oci/core/models/update_cross_connect_details.rb +2 -2
  85. data/lib/oci/core/models/update_cross_connect_group_details.rb +2 -2
  86. data/lib/oci/core/models/update_dhcp_details.rb +2 -2
  87. data/lib/oci/core/models/update_drg_attachment_details.rb +2 -2
  88. data/lib/oci/core/models/update_drg_details.rb +2 -2
  89. data/lib/oci/core/models/update_image_details.rb +2 -2
  90. data/lib/oci/core/models/update_instance_details.rb +2 -2
  91. data/lib/oci/core/models/update_internet_gateway_details.rb +2 -2
  92. data/lib/oci/core/models/update_ip_sec_connection_details.rb +2 -2
  93. data/lib/oci/core/models/update_private_ip_details.rb +2 -2
  94. data/lib/oci/core/models/update_route_table_details.rb +2 -2
  95. data/lib/oci/core/models/update_security_list_details.rb +2 -2
  96. data/lib/oci/core/models/update_subnet_details.rb +2 -2
  97. data/lib/oci/core/models/update_vcn_details.rb +2 -2
  98. data/lib/oci/core/models/update_virtual_circuit_details.rb +2 -3
  99. data/lib/oci/core/models/update_vnic_details.rb +2 -2
  100. data/lib/oci/core/models/update_volume_backup_details.rb +2 -2
  101. data/lib/oci/core/models/update_volume_details.rb +2 -2
  102. data/lib/oci/core/models/vcn.rb +2 -2
  103. data/lib/oci/core/models/virtual_circuit.rb +5 -5
  104. data/lib/oci/core/models/virtual_circuit_bandwidth_shape.rb +2 -2
  105. data/lib/oci/core/models/vnic.rb +2 -2
  106. data/lib/oci/core/models/vnic_attachment.rb +2 -2
  107. data/lib/oci/core/models/volume.rb +29 -5
  108. data/lib/oci/core/models/volume_attachment.rb +2 -2
  109. data/lib/oci/core/models/volume_backup.rb +2 -2
  110. data/lib/oci/core/models/volume_source_details.rb +131 -0
  111. data/lib/oci/core/models/volume_source_from_volume_backup_details.rb +128 -0
  112. data/lib/oci/core/models/volume_source_from_volume_details.rb +128 -0
  113. data/lib/oci/core/virtual_network_client.rb +312 -10
  114. data/lib/oci/database/database.rb +7 -0
  115. data/lib/oci/database/database_client.rb +228 -4
  116. data/lib/oci/database/models/backup.rb +253 -0
  117. data/lib/oci/database/models/backup_summary.rb +253 -0
  118. data/lib/oci/database/models/create_backup_details.rb +131 -0
  119. data/lib/oci/database/models/create_data_guard_association_details.rb +2 -2
  120. data/lib/oci/database/models/create_data_guard_association_to_existing_db_system_details.rb +2 -2
  121. data/lib/oci/database/models/create_database_details.rb +13 -3
  122. data/lib/oci/database/models/create_db_home_details.rb +2 -2
  123. data/lib/oci/database/models/create_db_home_with_db_system_id_details.rb +2 -2
  124. data/lib/oci/database/models/data_guard_association.rb +2 -2
  125. data/lib/oci/database/models/data_guard_association_summary.rb +374 -0
  126. data/lib/oci/database/models/database.rb +15 -3
  127. data/lib/oci/database/models/database_summary.rb +15 -3
  128. data/lib/oci/database/models/db_backup_config.rb +120 -0
  129. data/lib/oci/database/models/db_home.rb +2 -2
  130. data/lib/oci/database/models/db_home_summary.rb +2 -2
  131. data/lib/oci/database/models/db_node.rb +2 -2
  132. data/lib/oci/database/models/db_node_summary.rb +2 -2
  133. data/lib/oci/database/models/db_system.rb +9 -9
  134. data/lib/oci/database/models/db_system_shape_summary.rb +2 -2
  135. data/lib/oci/database/models/db_system_summary.rb +9 -9
  136. data/lib/oci/database/models/db_version_summary.rb +2 -2
  137. data/lib/oci/database/models/failover_data_guard_association_details.rb +2 -2
  138. data/lib/oci/database/models/launch_db_system_details.rb +2 -2
  139. data/lib/oci/database/models/patch.rb +4 -2
  140. data/lib/oci/database/models/patch_details.rb +4 -3
  141. data/lib/oci/database/models/patch_history_entry.rb +3 -2
  142. data/lib/oci/database/models/patch_history_entry_summary.rb +3 -2
  143. data/lib/oci/database/models/patch_summary.rb +4 -2
  144. data/lib/oci/database/models/reinstate_data_guard_association_details.rb +2 -2
  145. data/lib/oci/database/models/restore_database_details.rb +145 -0
  146. data/lib/oci/database/models/switchover_data_guard_association_details.rb +2 -2
  147. data/lib/oci/database/models/update_database_details.rb +119 -0
  148. data/lib/oci/database/models/update_db_home_details.rb +2 -2
  149. data/lib/oci/database/models/update_db_system_details.rb +9 -9
  150. data/lib/oci/identity/identity_client.rb +6 -5
  151. data/lib/oci/identity/models/add_user_to_group_details.rb +2 -2
  152. data/lib/oci/identity/models/api_key.rb +2 -2
  153. data/lib/oci/identity/models/availability_domain.rb +2 -2
  154. data/lib/oci/identity/models/compartment.rb +3 -3
  155. data/lib/oci/identity/models/create_api_key_details.rb +2 -2
  156. data/lib/oci/identity/models/create_compartment_details.rb +2 -2
  157. data/lib/oci/identity/models/create_customer_secret_key_details.rb +2 -2
  158. data/lib/oci/identity/models/create_group_details.rb +2 -2
  159. data/lib/oci/identity/models/create_identity_provider_details.rb +2 -2
  160. data/lib/oci/identity/models/create_idp_group_mapping_details.rb +2 -2
  161. data/lib/oci/identity/models/create_policy_details.rb +2 -2
  162. data/lib/oci/identity/models/create_region_subscription_details.rb +2 -2
  163. data/lib/oci/identity/models/create_saml2_identity_provider_details.rb +2 -2
  164. data/lib/oci/identity/models/create_swift_password_details.rb +2 -2
  165. data/lib/oci/identity/models/create_user_details.rb +2 -2
  166. data/lib/oci/identity/models/customer_secret_key.rb +2 -2
  167. data/lib/oci/identity/models/customer_secret_key_summary.rb +2 -2
  168. data/lib/oci/identity/models/group.rb +2 -2
  169. data/lib/oci/identity/models/identity_provider.rb +4 -4
  170. data/lib/oci/identity/models/idp_group_mapping.rb +2 -2
  171. data/lib/oci/identity/models/policy.rb +2 -2
  172. data/lib/oci/identity/models/region.rb +4 -4
  173. data/lib/oci/identity/models/region_subscription.rb +4 -4
  174. data/lib/oci/identity/models/saml2_identity_provider.rb +2 -2
  175. data/lib/oci/identity/models/swift_password.rb +2 -2
  176. data/lib/oci/identity/models/tenancy.rb +2 -2
  177. data/lib/oci/identity/models/ui_password.rb +2 -2
  178. data/lib/oci/identity/models/update_compartment_details.rb +2 -2
  179. data/lib/oci/identity/models/update_customer_secret_key_details.rb +2 -2
  180. data/lib/oci/identity/models/update_group_details.rb +2 -2
  181. data/lib/oci/identity/models/update_identity_provider_details.rb +2 -2
  182. data/lib/oci/identity/models/update_idp_group_mapping_details.rb +2 -2
  183. data/lib/oci/identity/models/update_policy_details.rb +2 -2
  184. data/lib/oci/identity/models/update_saml2_identity_provider_details.rb +2 -2
  185. data/lib/oci/identity/models/update_state_details.rb +2 -2
  186. data/lib/oci/identity/models/update_swift_password_details.rb +2 -2
  187. data/lib/oci/identity/models/update_user_details.rb +2 -2
  188. data/lib/oci/identity/models/user.rb +2 -2
  189. data/lib/oci/identity/models/user_group_membership.rb +2 -2
  190. data/lib/oci/load_balancer/load_balancer_client.rb +1 -1
  191. data/lib/oci/load_balancer/models/backend.rb +2 -2
  192. data/lib/oci/load_balancer/models/backend_details.rb +2 -2
  193. data/lib/oci/load_balancer/models/backend_health.rb +2 -2
  194. data/lib/oci/load_balancer/models/backend_set.rb +2 -2
  195. data/lib/oci/load_balancer/models/backend_set_details.rb +2 -2
  196. data/lib/oci/load_balancer/models/backend_set_health.rb +2 -2
  197. data/lib/oci/load_balancer/models/certificate.rb +2 -2
  198. data/lib/oci/load_balancer/models/certificate_details.rb +2 -2
  199. data/lib/oci/load_balancer/models/create_backend_details.rb +2 -2
  200. data/lib/oci/load_balancer/models/create_backend_set_details.rb +2 -2
  201. data/lib/oci/load_balancer/models/create_certificate_details.rb +2 -2
  202. data/lib/oci/load_balancer/models/create_listener_details.rb +2 -2
  203. data/lib/oci/load_balancer/models/create_load_balancer_details.rb +2 -2
  204. data/lib/oci/load_balancer/models/health_check_result.rb +2 -2
  205. data/lib/oci/load_balancer/models/health_checker.rb +2 -2
  206. data/lib/oci/load_balancer/models/health_checker_details.rb +2 -2
  207. data/lib/oci/load_balancer/models/ip_address.rb +2 -2
  208. data/lib/oci/load_balancer/models/listener.rb +2 -2
  209. data/lib/oci/load_balancer/models/listener_details.rb +2 -2
  210. data/lib/oci/load_balancer/models/load_balancer.rb +2 -2
  211. data/lib/oci/load_balancer/models/load_balancer_health.rb +2 -2
  212. data/lib/oci/load_balancer/models/load_balancer_health_summary.rb +2 -2
  213. data/lib/oci/load_balancer/models/load_balancer_policy.rb +2 -2
  214. data/lib/oci/load_balancer/models/load_balancer_protocol.rb +2 -2
  215. data/lib/oci/load_balancer/models/load_balancer_shape.rb +2 -2
  216. data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +2 -2
  217. data/lib/oci/load_balancer/models/ssl_configuration.rb +2 -2
  218. data/lib/oci/load_balancer/models/ssl_configuration_details.rb +2 -2
  219. data/lib/oci/load_balancer/models/update_backend_details.rb +2 -2
  220. data/lib/oci/load_balancer/models/update_backend_set_details.rb +2 -2
  221. data/lib/oci/load_balancer/models/update_health_checker_details.rb +2 -2
  222. data/lib/oci/load_balancer/models/update_listener_details.rb +2 -2
  223. data/lib/oci/load_balancer/models/update_load_balancer_details.rb +2 -2
  224. data/lib/oci/load_balancer/models/work_request.rb +2 -2
  225. data/lib/oci/load_balancer/models/work_request_error.rb +2 -2
  226. data/lib/oci/object_storage/models/bucket.rb +44 -12
  227. data/lib/oci/object_storage/models/bucket_summary.rb +6 -4
  228. data/lib/oci/object_storage/models/commit_multipart_upload_details.rb +2 -2
  229. data/lib/oci/object_storage/models/commit_multipart_upload_part_details.rb +2 -2
  230. data/lib/oci/object_storage/models/create_bucket_details.rb +41 -11
  231. data/lib/oci/object_storage/models/create_multipart_upload_details.rb +9 -7
  232. data/lib/oci/object_storage/models/create_preauthenticated_request_details.rb +6 -7
  233. data/lib/oci/object_storage/models/list_objects.rb +4 -3
  234. data/lib/oci/object_storage/models/multipart_upload.rb +3 -3
  235. data/lib/oci/object_storage/models/multipart_upload_part_summary.rb +6 -6
  236. data/lib/oci/object_storage/models/namespace_metadata.rb +142 -0
  237. data/lib/oci/object_storage/models/object_summary.rb +6 -4
  238. data/lib/oci/object_storage/models/preauthenticated_request.rb +13 -11
  239. data/lib/oci/object_storage/models/preauthenticated_request_summary.rb +8 -10
  240. data/lib/oci/object_storage/models/rename_object_details.rb +164 -0
  241. data/lib/oci/object_storage/models/restore_objects_details.rb +120 -0
  242. data/lib/oci/object_storage/models/update_bucket_details.rb +20 -8
  243. data/lib/oci/object_storage/models/update_namespace_metadata_details.rb +131 -0
  244. data/lib/oci/object_storage/object_storage.rb +4 -0
  245. data/lib/oci/object_storage/object_storage_client.rb +206 -94
  246. data/lib/oci/regions.rb +2 -1
  247. data/lib/oci/version.rb +1 -1
  248. metadata +22 -2
@@ -186,8 +186,8 @@ module OCI
186
186
  def to_hash
187
187
  hash = {}
188
188
  self.class.attribute_map.each_pair do |attr, param|
189
- value = self.send(attr)
190
- next if value.nil?
189
+ value = send(attr)
190
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
191
191
  hash[param] = _to_hash(value)
192
192
  end
193
193
  hash
@@ -30,10 +30,14 @@ module OCI
30
30
  # @return [String]
31
31
  attr_accessor :display_name
32
32
 
33
- # The volume's Oracle ID (OCID).
33
+ # The OCID of the volume.
34
34
  # @return [String]
35
35
  attr_accessor :id
36
36
 
37
+ # Specifies whether the cloned volume's data has finished copying from the source volume or backup.
38
+ # @return [BOOLEAN]
39
+ attr_accessor :is_hydrated
40
+
37
41
  # The current state of a volume.
38
42
  # @return [String]
39
43
  attr_accessor :lifecycle_state
@@ -42,10 +46,16 @@ module OCI
42
46
  # @return [Integer]
43
47
  attr_accessor :size_in_gbs
44
48
 
45
- # The size of the volume in MBs. This field is deprecated. Please use sizeInGBs.
49
+ # The size of the volume in MBs. This field is deprecated. Use sizeInGBs instead.
46
50
  # @return [Integer]
47
51
  attr_accessor :size_in_mbs
48
52
 
53
+ # The volume source, either an existing volume in the same Availability Domain or a volume backup.
54
+ # If null, an empty volume is created.
55
+ #
56
+ # @return [OCI::Core::Models::VolumeSourceDetails]
57
+ attr_accessor :source_details
58
+
49
59
  # The date and time the volume was created. Format defined by RFC3339.
50
60
  # @return [DateTime]
51
61
  attr_accessor :time_created
@@ -75,6 +85,10 @@ module OCI
75
85
  self.id = attributes[:'id']
76
86
  end
77
87
 
88
+ if attributes[:'isHydrated']
89
+ self.is_hydrated = attributes[:'isHydrated']
90
+ end
91
+
78
92
  if attributes[:'lifecycleState']
79
93
  self.lifecycle_state = attributes[:'lifecycleState']
80
94
  end
@@ -87,6 +101,10 @@ module OCI
87
101
  self.size_in_mbs = attributes[:'sizeInMBs']
88
102
  end
89
103
 
104
+ if attributes[:'sourceDetails']
105
+ self.source_details = attributes[:'sourceDetails']
106
+ end
107
+
90
108
  if attributes[:'timeCreated']
91
109
  self.time_created = attributes[:'timeCreated']
92
110
  end
@@ -112,9 +130,11 @@ module OCI
112
130
  compartment_id == other_object.compartment_id &&
113
131
  display_name == other_object.display_name &&
114
132
  id == other_object.id &&
133
+ is_hydrated == other_object.is_hydrated &&
115
134
  lifecycle_state == other_object.lifecycle_state &&
116
135
  size_in_gbs == other_object.size_in_gbs &&
117
136
  size_in_mbs == other_object.size_in_mbs &&
137
+ source_details == other_object.source_details &&
118
138
  time_created == other_object.time_created
119
139
  end
120
140
 
@@ -127,7 +147,7 @@ module OCI
127
147
  # Calculates hash code according to all attributes.
128
148
  # @return [Fixnum] Hash code
129
149
  def hash
130
- [availability_domain, compartment_id, display_name, id, lifecycle_state, size_in_gbs, size_in_mbs, time_created].hash
150
+ [availability_domain, compartment_id, display_name, id, is_hydrated, lifecycle_state, size_in_gbs, size_in_mbs, source_details, time_created].hash
131
151
  end
132
152
 
133
153
  # Builds the object from hash
@@ -161,8 +181,8 @@ module OCI
161
181
  def to_hash
162
182
  hash = {}
163
183
  self.class.attribute_map.each_pair do |attr, param|
164
- value = self.send(attr)
165
- next if value.nil?
184
+ value = send(attr)
185
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
166
186
  hash[param] = _to_hash(value)
167
187
  end
168
188
  hash
@@ -197,9 +217,11 @@ module OCI
197
217
  :'compartment_id' => :'compartmentId',
198
218
  :'display_name' => :'displayName',
199
219
  :'id' => :'id',
220
+ :'is_hydrated' => :'isHydrated',
200
221
  :'lifecycle_state' => :'lifecycleState',
201
222
  :'size_in_gbs' => :'sizeInGBs',
202
223
  :'size_in_mbs' => :'sizeInMBs',
224
+ :'source_details' => :'sourceDetails',
203
225
  :'time_created' => :'timeCreated'
204
226
  }
205
227
  end
@@ -211,9 +233,11 @@ module OCI
211
233
  :'compartment_id' => :'String',
212
234
  :'display_name' => :'String',
213
235
  :'id' => :'String',
236
+ :'is_hydrated' => :'BOOLEAN',
214
237
  :'lifecycle_state' => :'String',
215
238
  :'size_in_gbs' => :'Integer',
216
239
  :'size_in_mbs' => :'Integer',
240
+ :'source_details' => :'OCI::Core::Models::VolumeSourceDetails',
217
241
  :'time_created' => :'DateTime'
218
242
  }
219
243
  end
@@ -184,8 +184,8 @@ module OCI
184
184
  def to_hash
185
185
  hash = {}
186
186
  self.class.attribute_map.each_pair do |attr, param|
187
- value = self.send(attr)
188
- next if value.nil?
187
+ value = send(attr)
188
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
189
189
  hash[param] = _to_hash(value)
190
190
  end
191
191
  hash
@@ -196,8 +196,8 @@ module OCI
196
196
  def to_hash
197
197
  hash = {}
198
198
  self.class.attribute_map.each_pair do |attr, param|
199
- value = self.send(attr)
200
- next if value.nil?
199
+ value = send(attr)
200
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
201
201
  hash[param] = _to_hash(value)
202
202
  end
203
203
  hash
@@ -0,0 +1,131 @@
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::VolumeSourceDetails
7
+ # @return [String]
8
+ attr_accessor :type
9
+
10
+
11
+ # Given the hash representation of a subtype of this class,
12
+ # use the info in the hash to return the class of the subtype.
13
+ def self.get_subtype(object_hash)
14
+ type = object_hash[:'type']
15
+
16
+ return 'OCI::Core::Models::VolumeSourceFromVolumeDetails' if type == 'volume'
17
+ return 'OCI::Core::Models::VolumeSourceFromVolumeBackupDetails' if type == 'volumeBackup'
18
+
19
+ # TODO: Log a warning when the subtype is not found.
20
+ return 'OCI::Core::Models::VolumeSourceDetails'
21
+ end
22
+
23
+ # Initializes the object
24
+ # @param [Hash] attributes Model attributes in the form of hash
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
30
+
31
+ if attributes[:'type']
32
+ self.type = attributes[:'type']
33
+ end
34
+
35
+ end
36
+
37
+ # Checks equality by comparing each attribute.
38
+ # @param [Object] other_object to be compared
39
+ def ==(other_object)
40
+ return true if self.equal?(other_object)
41
+ self.class == other_object.class &&
42
+ type == other_object.type
43
+ end
44
+
45
+ # @see the `==` method
46
+ # @param [Object] other_object to be compared
47
+ def eql?(other_object)
48
+ self == other_object
49
+ end
50
+
51
+ # Calculates hash code according to all attributes.
52
+ # @return [Fixnum] Hash code
53
+ def hash
54
+ [type].hash
55
+ end
56
+
57
+ # Builds the object from hash
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ # @return [Object] Returns the model itself
60
+ def build_from_hash(attributes)
61
+ return nil unless attributes.is_a?(Hash)
62
+ self.class.swagger_types.each_pair do |key, type|
63
+ if type =~ /^Array<(.*)>/i
64
+ # check to ensure the input is an array given that the the attribute
65
+ # is documented as an array but the input is not
66
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
67
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
68
+ end
69
+ elsif !attributes[self.class.attribute_map[key]].nil?
70
+ self.send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
71
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
72
+ end
73
+
74
+ self
75
+ end
76
+
77
+ # Returns the string representation of the object
78
+ # @return [String] String presentation of the object
79
+ def to_s
80
+ to_hash.to_s
81
+ end
82
+
83
+ # Returns the object in the form of hash
84
+ # @return [Hash] Returns the object in the form of hash
85
+ def to_hash
86
+ hash = {}
87
+ self.class.attribute_map.each_pair do |attr, param|
88
+ value = send(attr)
89
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
90
+ hash[param] = _to_hash(value)
91
+ end
92
+ hash
93
+ end
94
+
95
+ private
96
+
97
+ # Outputs non-array value in the form of hash
98
+ # For object, use to_hash. Otherwise, just return the value
99
+ # @param [Object] value Any valid value
100
+ # @return [Hash] Returns the value in the form of hash
101
+ def _to_hash(value)
102
+ if value.is_a?(Array)
103
+ value.compact.map{ |v| _to_hash(v) }
104
+ elsif value.is_a?(Hash)
105
+ {}.tap do |hash|
106
+ value.each { |k, v| hash[k] = _to_hash(v) }
107
+ end
108
+ elsif value.respond_to? :to_hash
109
+ value.to_hash
110
+ else
111
+ value
112
+ end
113
+ end
114
+
115
+
116
+
117
+ # Attribute mapping from ruby-style variable name to JSON key.
118
+ def self.attribute_map
119
+ {
120
+ :'type' => :'type'
121
+ }
122
+ end
123
+
124
+ # Attribute type mapping.
125
+ def self.swagger_types
126
+ {
127
+ :'type' => :'String'
128
+ }
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,128 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require_relative 'volume_source_details'
5
+
6
+ module OCI
7
+ class Core::Models::VolumeSourceFromVolumeBackupDetails < Core::Models::VolumeSourceDetails
8
+ # The OCID of the volume backup.
9
+ # @return [String]
10
+ attr_accessor :id
11
+
12
+
13
+ # Initializes the object
14
+ # @param [Hash] attributes Model attributes in the form of hash
15
+ def initialize(attributes = {})
16
+ return unless attributes.is_a?(Hash)
17
+
18
+ attributes['type'] = 'volumeBackup'
19
+
20
+ super(attributes)
21
+
22
+ # convert string to symbol for hash key
23
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
24
+
25
+ if attributes[:'id']
26
+ self.id = attributes[:'id']
27
+ end
28
+
29
+ end
30
+
31
+ # Checks equality by comparing each attribute.
32
+ # @param [Object] other_object to be compared
33
+ def ==(other_object)
34
+ return true if self.equal?(other_object)
35
+ self.class == other_object.class &&
36
+ type == other_object.type &&
37
+ id == other_object.id
38
+ end
39
+
40
+ # @see the `==` method
41
+ # @param [Object] other_object to be compared
42
+ def eql?(other_object)
43
+ self == other_object
44
+ end
45
+
46
+ # Calculates hash code according to all attributes.
47
+ # @return [Fixnum] Hash code
48
+ def hash
49
+ [type, id].hash
50
+ end
51
+
52
+ # Builds the object from hash
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ # @return [Object] Returns the model itself
55
+ def build_from_hash(attributes)
56
+ return nil unless attributes.is_a?(Hash)
57
+ self.class.swagger_types.each_pair do |key, type|
58
+ if type =~ /^Array<(.*)>/i
59
+ # check to ensure the input is an array given that the the attribute
60
+ # is documented as an array but the input is not
61
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
62
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
63
+ end
64
+ elsif !attributes[self.class.attribute_map[key]].nil?
65
+ self.send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
66
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
67
+ end
68
+
69
+ self
70
+ end
71
+
72
+ # Returns the string representation of the object
73
+ # @return [String] String presentation of the object
74
+ def to_s
75
+ to_hash.to_s
76
+ end
77
+
78
+ # Returns the object in the form of hash
79
+ # @return [Hash] Returns the object in the form of hash
80
+ def to_hash
81
+ hash = {}
82
+ self.class.attribute_map.each_pair do |attr, param|
83
+ value = send(attr)
84
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
85
+ hash[param] = _to_hash(value)
86
+ end
87
+ hash
88
+ end
89
+
90
+ private
91
+
92
+ # Outputs non-array value in the form of hash
93
+ # For object, use to_hash. Otherwise, just return the value
94
+ # @param [Object] value Any valid value
95
+ # @return [Hash] Returns the value in the form of hash
96
+ def _to_hash(value)
97
+ if value.is_a?(Array)
98
+ value.compact.map{ |v| _to_hash(v) }
99
+ elsif value.is_a?(Hash)
100
+ {}.tap do |hash|
101
+ value.each { |k, v| hash[k] = _to_hash(v) }
102
+ end
103
+ elsif value.respond_to? :to_hash
104
+ value.to_hash
105
+ else
106
+ value
107
+ end
108
+ end
109
+
110
+
111
+
112
+ # Attribute mapping from ruby-style variable name to JSON key.
113
+ def self.attribute_map
114
+ {
115
+ :'type' => :'type',
116
+ :'id' => :'id'
117
+ }
118
+ end
119
+
120
+ # Attribute type mapping.
121
+ def self.swagger_types
122
+ {
123
+ :'type' => :'String',
124
+ :'id' => :'String'
125
+ }
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,128 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require_relative 'volume_source_details'
5
+
6
+ module OCI
7
+ class Core::Models::VolumeSourceFromVolumeDetails < Core::Models::VolumeSourceDetails
8
+ # The OCID of the volume.
9
+ # @return [String]
10
+ attr_accessor :id
11
+
12
+
13
+ # Initializes the object
14
+ # @param [Hash] attributes Model attributes in the form of hash
15
+ def initialize(attributes = {})
16
+ return unless attributes.is_a?(Hash)
17
+
18
+ attributes['type'] = 'volume'
19
+
20
+ super(attributes)
21
+
22
+ # convert string to symbol for hash key
23
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
24
+
25
+ if attributes[:'id']
26
+ self.id = attributes[:'id']
27
+ end
28
+
29
+ end
30
+
31
+ # Checks equality by comparing each attribute.
32
+ # @param [Object] other_object to be compared
33
+ def ==(other_object)
34
+ return true if self.equal?(other_object)
35
+ self.class == other_object.class &&
36
+ type == other_object.type &&
37
+ id == other_object.id
38
+ end
39
+
40
+ # @see the `==` method
41
+ # @param [Object] other_object to be compared
42
+ def eql?(other_object)
43
+ self == other_object
44
+ end
45
+
46
+ # Calculates hash code according to all attributes.
47
+ # @return [Fixnum] Hash code
48
+ def hash
49
+ [type, id].hash
50
+ end
51
+
52
+ # Builds the object from hash
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ # @return [Object] Returns the model itself
55
+ def build_from_hash(attributes)
56
+ return nil unless attributes.is_a?(Hash)
57
+ self.class.swagger_types.each_pair do |key, type|
58
+ if type =~ /^Array<(.*)>/i
59
+ # check to ensure the input is an array given that the the attribute
60
+ # is documented as an array but the input is not
61
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
62
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
63
+ end
64
+ elsif !attributes[self.class.attribute_map[key]].nil?
65
+ self.send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
66
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
67
+ end
68
+
69
+ self
70
+ end
71
+
72
+ # Returns the string representation of the object
73
+ # @return [String] String presentation of the object
74
+ def to_s
75
+ to_hash.to_s
76
+ end
77
+
78
+ # Returns the object in the form of hash
79
+ # @return [Hash] Returns the object in the form of hash
80
+ def to_hash
81
+ hash = {}
82
+ self.class.attribute_map.each_pair do |attr, param|
83
+ value = send(attr)
84
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
85
+ hash[param] = _to_hash(value)
86
+ end
87
+ hash
88
+ end
89
+
90
+ private
91
+
92
+ # Outputs non-array value in the form of hash
93
+ # For object, use to_hash. Otherwise, just return the value
94
+ # @param [Object] value Any valid value
95
+ # @return [Hash] Returns the value in the form of hash
96
+ def _to_hash(value)
97
+ if value.is_a?(Array)
98
+ value.compact.map{ |v| _to_hash(v) }
99
+ elsif value.is_a?(Hash)
100
+ {}.tap do |hash|
101
+ value.each { |k, v| hash[k] = _to_hash(v) }
102
+ end
103
+ elsif value.respond_to? :to_hash
104
+ value.to_hash
105
+ else
106
+ value
107
+ end
108
+ end
109
+
110
+
111
+
112
+ # Attribute mapping from ruby-style variable name to JSON key.
113
+ def self.attribute_map
114
+ {
115
+ :'type' => :'type',
116
+ :'id' => :'id'
117
+ }
118
+ end
119
+
120
+ # Attribute type mapping.
121
+ def self.swagger_types
122
+ {
123
+ :'type' => :'String',
124
+ :'id' => :'String'
125
+ }
126
+ end
127
+ end
128
+ end