oci 2.1.0 → 2.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 (370) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -3
  3. data/lib/oci.rb +6 -0
  4. data/lib/oci/api_client.rb +159 -134
  5. data/lib/oci/audit/audit.rb +3 -0
  6. data/lib/oci/audit/audit_client.rb +88 -40
  7. data/lib/oci/audit/audit_client_composite_operations.rb +64 -0
  8. data/lib/oci/audit/models/audit_event.rb +151 -200
  9. data/lib/oci/audit/models/configuration.rb +61 -38
  10. data/lib/oci/audit/models/update_configuration_details.rb +61 -38
  11. data/lib/oci/auth/util.rb +1 -1
  12. data/lib/oci/base_signer.rb +20 -29
  13. data/lib/oci/config.rb +9 -3
  14. data/lib/oci/core/blockstorage_client.rb +512 -269
  15. data/lib/oci/core/blockstorage_client_composite_operations.rb +342 -0
  16. data/lib/oci/core/compute_client.rb +959 -536
  17. data/lib/oci/core/compute_client_composite_operations.rb +738 -0
  18. data/lib/oci/core/core.rb +5 -0
  19. data/lib/oci/core/models/attach_boot_volume_details.rb +72 -57
  20. data/lib/oci/core/models/attach_i_scsi_volume_details.rb +76 -53
  21. data/lib/oci/core/models/attach_paravirtualized_volume_details.rb +69 -45
  22. data/lib/oci/core/models/attach_vnic_details.rb +79 -68
  23. data/lib/oci/core/models/attach_volume_details.rb +83 -74
  24. data/lib/oci/core/models/boot_volume.rb +119 -120
  25. data/lib/oci/core/models/boot_volume_attachment.rb +114 -111
  26. data/lib/oci/core/models/bulk_add_virtual_circuit_public_prefixes_details.rb +61 -38
  27. data/lib/oci/core/models/bulk_delete_virtual_circuit_public_prefixes_details.rb +61 -38
  28. data/lib/oci/core/models/capture_console_history_details.rb +81 -70
  29. data/lib/oci/core/models/connect_local_peering_gateways_details.rb +60 -38
  30. data/lib/oci/core/models/connect_remote_peering_connections_details.rb +67 -49
  31. data/lib/oci/core/models/console_history.rb +122 -123
  32. data/lib/oci/core/models/cpe.rb +82 -74
  33. data/lib/oci/core/models/create_cpe_details.rb +73 -58
  34. data/lib/oci/core/models/create_cross_connect_details.rb +98 -99
  35. data/lib/oci/core/models/create_cross_connect_group_details.rb +67 -48
  36. data/lib/oci/core/models/create_dhcp_details.rb +89 -84
  37. data/lib/oci/core/models/create_drg_attachment_details.rb +71 -56
  38. data/lib/oci/core/models/create_drg_details.rb +66 -47
  39. data/lib/oci/core/models/create_image_details.rb +108 -110
  40. data/lib/oci/core/models/create_instance_console_connection_details.rb +79 -69
  41. data/lib/oci/core/models/create_internet_gateway_details.rb +76 -65
  42. data/lib/oci/core/models/create_ip_sec_connection_details.rb +83 -76
  43. data/lib/oci/core/models/create_local_peering_gateway_details.rb +72 -57
  44. data/lib/oci/core/models/create_private_ip_details.rb +97 -94
  45. data/lib/oci/core/models/create_public_ip_details.rb +90 -77
  46. data/lib/oci/core/models/create_remote_peering_connection_details.rb +72 -57
  47. data/lib/oci/core/models/create_route_table_details.rb +90 -87
  48. data/lib/oci/core/models/create_security_list_details.rb +95 -96
  49. data/lib/oci/core/models/create_subnet_details.rb +133 -154
  50. data/lib/oci/core/models/create_vcn_details.rb +96 -93
  51. data/lib/oci/core/models/create_virtual_circuit_details.rb +136 -153
  52. data/lib/oci/core/models/create_virtual_circuit_public_prefix_details.rb +62 -39
  53. data/lib/oci/core/models/create_vnic_details.rb +99 -97
  54. data/lib/oci/core/models/create_volume_backup_details.rb +94 -85
  55. data/lib/oci/core/models/create_volume_backup_policy_assignment_details.rb +66 -47
  56. data/lib/oci/core/models/create_volume_details.rb +117 -130
  57. data/lib/oci/core/models/cross_connect.rb +120 -121
  58. data/lib/oci/core/models/cross_connect_group.rb +97 -82
  59. data/lib/oci/core/models/cross_connect_location.rb +65 -43
  60. data/lib/oci/core/models/cross_connect_mapping.rb +89 -81
  61. data/lib/oci/core/models/cross_connect_port_speed_shape.rb +68 -48
  62. data/lib/oci/core/models/cross_connect_status.rb +110 -87
  63. data/lib/oci/core/models/delete_virtual_circuit_public_prefix_details.rb +61 -38
  64. data/lib/oci/core/models/dhcp_dns_option.rb +85 -60
  65. data/lib/oci/core/models/dhcp_option.rb +62 -38
  66. data/lib/oci/core/models/dhcp_options.rb +119 -118
  67. data/lib/oci/core/models/dhcp_search_domain_option.rb +66 -44
  68. data/lib/oci/core/models/drg.rb +96 -81
  69. data/lib/oci/core/models/drg_attachment.rb +106 -99
  70. data/lib/oci/core/models/egress_security_rule.rb +89 -83
  71. data/lib/oci/core/models/export_image_details.rb +63 -41
  72. data/lib/oci/core/models/export_image_via_object_storage_tuple_details.rb +74 -59
  73. data/lib/oci/core/models/export_image_via_object_storage_uri_details.rb +65 -42
  74. data/lib/oci/core/models/fast_connect_provider_service.rb +155 -126
  75. data/lib/oci/core/models/get_public_ip_by_ip_address_details.rb +61 -39
  76. data/lib/oci/core/models/get_public_ip_by_private_ip_id_details.rb +61 -39
  77. data/lib/oci/core/models/i_scsi_volume_attachment.rb +117 -105
  78. data/lib/oci/core/models/icmp_options.rb +63 -41
  79. data/lib/oci/core/models/image.rb +170 -185
  80. data/lib/oci/core/models/image_source_details.rb +79 -60
  81. data/lib/oci/core/models/image_source_via_object_storage_tuple_details.rb +77 -62
  82. data/lib/oci/core/models/image_source_via_object_storage_uri_details.rb +67 -44
  83. data/lib/oci/core/models/ingress_security_rule.rb +89 -83
  84. data/lib/oci/core/models/instance.rb +190 -211
  85. data/lib/oci/core/models/instance_console_connection.rb +118 -117
  86. data/lib/oci/core/models/instance_credentials.rb +63 -41
  87. data/lib/oci/core/models/instance_source_details.rb +64 -41
  88. data/lib/oci/core/models/instance_source_via_boot_volume_details.rb +64 -41
  89. data/lib/oci/core/models/instance_source_via_image_details.rb +70 -51
  90. data/lib/oci/core/models/internet_gateway.rb +107 -100
  91. data/lib/oci/core/models/ip_sec_connection.rb +113 -110
  92. data/lib/oci/core/models/ip_sec_connection_device_config.rb +73 -59
  93. data/lib/oci/core/models/ip_sec_connection_device_status.rb +75 -61
  94. data/lib/oci/core/models/launch_instance_details.rb +163 -189
  95. data/lib/oci/core/models/launch_options.rb +130 -93
  96. data/lib/oci/core/models/letter_of_authority.rb +105 -100
  97. data/lib/oci/core/models/local_peering_gateway.rb +141 -140
  98. data/lib/oci/core/models/paravirtualized_volume_attachment.rb +83 -60
  99. data/lib/oci/core/models/peer_region_for_remote_peering.rb +61 -37
  100. data/lib/oci/core/models/port_range.rb +65 -42
  101. data/lib/oci/core/models/private_ip.rb +131 -151
  102. data/lib/oci/core/models/public_ip.rb +160 -149
  103. data/lib/oci/core/models/remote_peering_connection.rb +148 -151
  104. data/lib/oci/core/models/route_rule.rb +68 -50
  105. data/lib/oci/core/models/route_table.rb +120 -121
  106. data/lib/oci/core/models/security_list.rb +125 -130
  107. data/lib/oci/core/models/shape.rb +60 -36
  108. data/lib/oci/core/models/subnet.rb +183 -220
  109. data/lib/oci/core/models/tcp_options.rb +67 -49
  110. data/lib/oci/core/models/tunnel_config.rb +76 -62
  111. data/lib/oci/core/models/tunnel_status.rb +94 -77
  112. data/lib/oci/core/models/udp_options.rb +67 -49
  113. data/lib/oci/core/models/update_boot_volume_details.rb +62 -39
  114. data/lib/oci/core/models/update_console_history_details.rb +76 -61
  115. data/lib/oci/core/models/update_cpe_details.rb +62 -39
  116. data/lib/oci/core/models/update_cross_connect_details.rb +68 -50
  117. data/lib/oci/core/models/update_cross_connect_group_details.rb +62 -39
  118. data/lib/oci/core/models/update_dhcp_details.rb +80 -67
  119. data/lib/oci/core/models/update_drg_attachment_details.rb +62 -39
  120. data/lib/oci/core/models/update_drg_details.rb +62 -39
  121. data/lib/oci/core/models/update_image_details.rb +77 -62
  122. data/lib/oci/core/models/update_instance_details.rb +77 -62
  123. data/lib/oci/core/models/update_internet_gateway_details.rb +67 -48
  124. data/lib/oci/core/models/update_ip_sec_connection_details.rb +62 -39
  125. data/lib/oci/core/models/update_local_peering_gateway_details.rb +62 -39
  126. data/lib/oci/core/models/update_private_ip_details.rb +90 -83
  127. data/lib/oci/core/models/update_public_ip_details.rb +68 -49
  128. data/lib/oci/core/models/update_remote_peering_connection_details.rb +62 -39
  129. data/lib/oci/core/models/update_route_table_details.rb +81 -70
  130. data/lib/oci/core/models/update_security_list_details.rb +86 -79
  131. data/lib/oci/core/models/update_subnet_details.rb +76 -61
  132. data/lib/oci/core/models/update_vcn_details.rb +76 -61
  133. data/lib/oci/core/models/update_virtual_circuit_details.rb +114 -115
  134. data/lib/oci/core/models/update_vnic_details.rb +75 -60
  135. data/lib/oci/core/models/update_volume_backup_details.rb +76 -61
  136. data/lib/oci/core/models/update_volume_details.rb +76 -61
  137. data/lib/oci/core/models/vcn.rb +150 -167
  138. data/lib/oci/core/models/virtual_circuit.rb +254 -269
  139. data/lib/oci/core/models/virtual_circuit_bandwidth_shape.rb +68 -48
  140. data/lib/oci/core/models/virtual_circuit_public_prefix.rb +79 -54
  141. data/lib/oci/core/models/vnic.rb +149 -166
  142. data/lib/oci/core/models/vnic_attachment.rb +132 -141
  143. data/lib/oci/core/models/volume.rb +138 -151
  144. data/lib/oci/core/models/volume_attachment.rb +126 -131
  145. data/lib/oci/core/models/volume_backup.rb +185 -200
  146. data/lib/oci/core/models/volume_backup_policy.rb +75 -61
  147. data/lib/oci/core/models/volume_backup_policy_assignment.rb +75 -63
  148. data/lib/oci/core/models/volume_backup_schedule.rb +101 -76
  149. data/lib/oci/core/models/volume_source_details.rb +62 -37
  150. data/lib/oci/core/models/volume_source_from_volume_backup_details.rb +62 -38
  151. data/lib/oci/core/models/volume_source_from_volume_details.rb +62 -38
  152. data/lib/oci/core/virtual_network_client.rb +2683 -1457
  153. data/lib/oci/core/virtual_network_client_composite_operations.rb +1849 -0
  154. data/lib/oci/database/database.rb +3 -0
  155. data/lib/oci/database/database_client.rb +894 -454
  156. data/lib/oci/database/database_client_composite_operations.rb +462 -0
  157. data/lib/oci/database/models/backup.rb +131 -128
  158. data/lib/oci/database/models/backup_summary.rb +131 -128
  159. data/lib/oci/database/models/create_backup_details.rb +66 -47
  160. data/lib/oci/database/models/create_data_guard_association_details.rb +112 -102
  161. data/lib/oci/database/models/create_data_guard_association_to_existing_db_system_details.rb +73 -51
  162. data/lib/oci/database/models/create_database_details.rb +140 -105
  163. data/lib/oci/database/models/create_database_from_backup_details.rb +71 -56
  164. data/lib/oci/database/models/create_db_home_details.rb +70 -53
  165. data/lib/oci/database/models/create_db_home_with_db_system_id_base.rb +83 -67
  166. data/lib/oci/database/models/create_db_home_with_db_system_id_details.rb +74 -53
  167. data/lib/oci/database/models/create_db_home_with_db_system_id_from_backup_details.rb +69 -44
  168. data/lib/oci/database/models/data_guard_association.rb +205 -204
  169. data/lib/oci/database/models/data_guard_association_summary.rb +205 -204
  170. data/lib/oci/database/models/database.rb +175 -156
  171. data/lib/oci/database/models/database_summary.rb +175 -156
  172. data/lib/oci/database/models/db_backup_config.rb +60 -38
  173. data/lib/oci/database/models/db_home.rb +110 -107
  174. data/lib/oci/database/models/db_home_summary.rb +110 -107
  175. data/lib/oci/database/models/db_node.rb +113 -108
  176. data/lib/oci/database/models/db_node_summary.rb +113 -108
  177. data/lib/oci/database/models/db_system.rb +299 -314
  178. data/lib/oci/database/models/db_system_shape_summary.rb +88 -86
  179. data/lib/oci/database/models/db_system_summary.rb +299 -314
  180. data/lib/oci/database/models/db_version_summary.rb +64 -44
  181. data/lib/oci/database/models/failover_data_guard_association_details.rb +60 -38
  182. data/lib/oci/database/models/launch_db_system_details.rb +231 -234
  183. data/lib/oci/database/models/patch.rb +136 -113
  184. data/lib/oci/database/models/patch_details.rb +73 -53
  185. data/lib/oci/database/models/patch_history_entry.rb +114 -99
  186. data/lib/oci/database/models/patch_history_entry_summary.rb +114 -99
  187. data/lib/oci/database/models/patch_summary.rb +136 -113
  188. data/lib/oci/database/models/reinstate_data_guard_association_details.rb +60 -38
  189. data/lib/oci/database/models/restore_database_details.rb +72 -53
  190. data/lib/oci/database/models/switchover_data_guard_association_details.rb +60 -38
  191. data/lib/oci/database/models/update_database_details.rb +97 -38
  192. data/lib/oci/database/models/update_db_home_details.rb +60 -38
  193. data/lib/oci/database/models/update_db_system_details.rb +112 -64
  194. data/lib/oci/dns/dns.rb +3 -0
  195. data/lib/oci/dns/dns_client.rb +489 -302
  196. data/lib/oci/dns/dns_client_composite_operations.rb +143 -0
  197. data/lib/oci/dns/models/create_zone_details.rb +84 -72
  198. data/lib/oci/dns/models/external_master.rb +67 -47
  199. data/lib/oci/dns/models/patch_domain_records_details.rb +60 -35
  200. data/lib/oci/dns/models/patch_rr_set_details.rb +60 -35
  201. data/lib/oci/dns/models/patch_zone_records_details.rb +60 -35
  202. data/lib/oci/dns/models/record.rb +92 -86
  203. data/lib/oci/dns/models/record_collection.rb +59 -35
  204. data/lib/oci/dns/models/record_details.rb +92 -86
  205. data/lib/oci/dns/models/record_operation.rb +113 -110
  206. data/lib/oci/dns/models/rr_set.rb +59 -35
  207. data/lib/oci/dns/models/sort_order.rb +0 -2
  208. data/lib/oci/dns/models/tsig.rb +68 -48
  209. data/lib/oci/dns/models/update_domain_records_details.rb +60 -35
  210. data/lib/oci/dns/models/update_rr_set_details.rb +60 -35
  211. data/lib/oci/dns/models/update_zone_details.rb +60 -38
  212. data/lib/oci/dns/models/update_zone_records_details.rb +60 -35
  213. data/lib/oci/dns/models/zone.rb +133 -126
  214. data/lib/oci/dns/models/zone_summary.rb +108 -99
  215. data/lib/oci/email/email.rb +3 -0
  216. data/lib/oci/email/email_client.rb +223 -112
  217. data/lib/oci/email/email_client_composite_operations.rb +103 -0
  218. data/lib/oci/email/models/create_sender_details.rb +65 -47
  219. data/lib/oci/email/models/create_suppression_details.rb +66 -48
  220. data/lib/oci/email/models/sender.rb +97 -84
  221. data/lib/oci/email/models/sender_summary.rb +89 -70
  222. data/lib/oci/email/models/suppression.rb +90 -69
  223. data/lib/oci/email/models/suppression_summary.rb +90 -69
  224. data/lib/oci/errors.rb +16 -0
  225. data/lib/oci/file_storage/file_storage.rb +3 -0
  226. data/lib/oci/file_storage/file_storage_client.rb +587 -333
  227. data/lib/oci/file_storage/file_storage_client_composite_operations.rb +460 -0
  228. data/lib/oci/file_storage/models/create_export_details.rb +73 -56
  229. data/lib/oci/file_storage/models/create_file_system_details.rb +75 -60
  230. data/lib/oci/file_storage/models/create_mount_target_details.rb +96 -93
  231. data/lib/oci/file_storage/models/create_snapshot_details.rb +68 -47
  232. data/lib/oci/file_storage/models/export.rb +102 -89
  233. data/lib/oci/file_storage/models/export_set.rb +121 -122
  234. data/lib/oci/file_storage/models/export_set_summary.rb +109 -102
  235. data/lib/oci/file_storage/models/export_summary.rb +102 -89
  236. data/lib/oci/file_storage/models/file_system.rb +110 -103
  237. data/lib/oci/file_storage/models/file_system_summary.rb +110 -103
  238. data/lib/oci/file_storage/models/mount_target.rb +126 -131
  239. data/lib/oci/file_storage/models/mount_target_summary.rb +121 -122
  240. data/lib/oci/file_storage/models/snapshot.rb +98 -81
  241. data/lib/oci/file_storage/models/snapshot_summary.rb +98 -81
  242. data/lib/oci/file_storage/models/update_export_set_details.rb +75 -60
  243. data/lib/oci/file_storage/models/update_file_system_details.rb +63 -40
  244. data/lib/oci/file_storage/models/update_mount_target_details.rb +63 -40
  245. data/lib/oci/identity/identity.rb +3 -0
  246. data/lib/oci/identity/identity_client.rb +1671 -872
  247. data/lib/oci/identity/identity_client_composite_operations.rb +818 -0
  248. data/lib/oci/identity/models/add_user_to_group_details.rb +66 -47
  249. data/lib/oci/identity/models/api_key.rb +108 -101
  250. data/lib/oci/identity/models/availability_domain.rb +64 -44
  251. data/lib/oci/identity/models/compartment.rb +118 -115
  252. data/lib/oci/identity/models/create_api_key_details.rb +60 -35
  253. data/lib/oci/identity/models/create_compartment_details.rb +83 -72
  254. data/lib/oci/identity/models/create_customer_secret_key_details.rb +62 -39
  255. data/lib/oci/identity/models/create_dynamic_group_details.rb +75 -61
  256. data/lib/oci/identity/models/create_group_details.rb +82 -71
  257. data/lib/oci/identity/models/create_identity_provider_details.rb +115 -110
  258. data/lib/oci/identity/models/create_idp_group_mapping_details.rb +67 -48
  259. data/lib/oci/identity/models/create_policy_details.rb +94 -89
  260. data/lib/oci/identity/models/create_region_subscription_details.rb +64 -41
  261. data/lib/oci/identity/models/create_saml2_identity_provider_details.rb +88 -67
  262. data/lib/oci/identity/models/create_smtp_credential_details.rb +61 -36
  263. data/lib/oci/identity/models/create_swift_password_details.rb +61 -36
  264. data/lib/oci/identity/models/create_tag_details.rb +77 -62
  265. data/lib/oci/identity/models/create_tag_namespace_details.rb +82 -71
  266. data/lib/oci/identity/models/create_user_details.rb +82 -71
  267. data/lib/oci/identity/models/customer_secret_key.rb +114 -109
  268. data/lib/oci/identity/models/customer_secret_key_summary.rb +109 -102
  269. data/lib/oci/identity/models/dynamic_group.rb +112 -105
  270. data/lib/oci/identity/models/group.rb +118 -115
  271. data/lib/oci/identity/models/identity_provider.rb +135 -138
  272. data/lib/oci/identity/models/idp_group_mapping.rb +112 -109
  273. data/lib/oci/identity/models/policy.rb +129 -132
  274. data/lib/oci/identity/models/region.rb +67 -45
  275. data/lib/oci/identity/models/region_subscription.rb +90 -71
  276. data/lib/oci/identity/models/saml2_identity_provider.rb +106 -92
  277. data/lib/oci/identity/models/smtp_credential.rb +118 -113
  278. data/lib/oci/identity/models/smtp_credential_summary.rb +113 -106
  279. data/lib/oci/identity/models/swift_password.rb +113 -106
  280. data/lib/oci/identity/models/tag.rb +108 -116
  281. data/lib/oci/identity/models/tag_namespace.rb +97 -97
  282. data/lib/oci/identity/models/tag_namespace_summary.rb +97 -97
  283. data/lib/oci/identity/models/tag_summary.rb +97 -97
  284. data/lib/oci/identity/models/tenancy.rb +86 -78
  285. data/lib/oci/identity/models/ui_password.rb +97 -82
  286. data/lib/oci/identity/models/update_compartment_details.rb +77 -62
  287. data/lib/oci/identity/models/update_customer_secret_key_details.rb +61 -38
  288. data/lib/oci/identity/models/update_dynamic_group_details.rb +65 -45
  289. data/lib/oci/identity/models/update_group_details.rb +72 -55
  290. data/lib/oci/identity/models/update_identity_provider_details.rb +89 -74
  291. data/lib/oci/identity/models/update_idp_group_mapping_details.rb +66 -47
  292. data/lib/oci/identity/models/update_policy_details.rb +83 -72
  293. data/lib/oci/identity/models/update_saml2_identity_provider_details.rb +79 -58
  294. data/lib/oci/identity/models/update_smtp_credential_details.rb +60 -35
  295. data/lib/oci/identity/models/update_state_details.rb +61 -36
  296. data/lib/oci/identity/models/update_swift_password_details.rb +60 -35
  297. data/lib/oci/identity/models/update_tag_details.rb +78 -65
  298. data/lib/oci/identity/models/update_tag_namespace_details.rb +78 -65
  299. data/lib/oci/identity/models/update_user_details.rb +72 -55
  300. data/lib/oci/identity/models/user.rb +120 -117
  301. data/lib/oci/identity/models/user_group_membership.rb +107 -100
  302. data/lib/oci/load_balancer/load_balancer.rb +3 -0
  303. data/lib/oci/load_balancer/load_balancer_client.rb +918 -500
  304. data/lib/oci/load_balancer/load_balancer_client_composite_operations.rb +795 -0
  305. data/lib/oci/load_balancer/models/backend.rb +101 -94
  306. data/lib/oci/load_balancer/models/backend_details.rb +95 -86
  307. data/lib/oci/load_balancer/models/backend_health.rb +84 -57
  308. data/lib/oci/load_balancer/models/backend_set.rb +87 -79
  309. data/lib/oci/load_balancer/models/backend_set_details.rb +80 -70
  310. data/lib/oci/load_balancer/models/backend_set_health.rb +106 -91
  311. data/lib/oci/load_balancer/models/certificate.rb +78 -64
  312. data/lib/oci/load_balancer/models/certificate_details.rb +92 -84
  313. data/lib/oci/load_balancer/models/connection_configuration.rb +73 -51
  314. data/lib/oci/load_balancer/models/create_backend_details.rb +95 -86
  315. data/lib/oci/load_balancer/models/create_backend_set_details.rb +87 -79
  316. data/lib/oci/load_balancer/models/create_certificate_details.rb +92 -84
  317. data/lib/oci/load_balancer/models/create_listener_details.rb +97 -93
  318. data/lib/oci/load_balancer/models/create_load_balancer_details.rb +109 -117
  319. data/lib/oci/load_balancer/models/create_path_route_set_details.rb +66 -46
  320. data/lib/oci/load_balancer/models/health_check_result.rb +98 -79
  321. data/lib/oci/load_balancer/models/health_checker.rb +108 -108
  322. data/lib/oci/load_balancer/models/health_checker_details.rb +108 -108
  323. data/lib/oci/load_balancer/models/ip_address.rb +70 -52
  324. data/lib/oci/load_balancer/models/listener.rb +97 -93
  325. data/lib/oci/load_balancer/models/listener_details.rb +91 -85
  326. data/lib/oci/load_balancer/models/load_balancer.rb +144 -157
  327. data/lib/oci/load_balancer/models/load_balancer_health.rb +110 -95
  328. data/lib/oci/load_balancer/models/load_balancer_health_summary.rb +88 -61
  329. data/lib/oci/load_balancer/models/load_balancer_policy.rb +59 -35
  330. data/lib/oci/load_balancer/models/load_balancer_protocol.rb +59 -35
  331. data/lib/oci/load_balancer/models/load_balancer_shape.rb +59 -35
  332. data/lib/oci/load_balancer/models/path_match_type.rb +80 -51
  333. data/lib/oci/load_balancer/models/path_route.rb +76 -60
  334. data/lib/oci/load_balancer/models/path_route_set.rb +66 -46
  335. data/lib/oci/load_balancer/models/path_route_set_details.rb +60 -38
  336. data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +71 -55
  337. data/lib/oci/load_balancer/models/ssl_configuration.rb +78 -66
  338. data/lib/oci/load_balancer/models/ssl_configuration_details.rb +78 -66
  339. data/lib/oci/load_balancer/models/update_backend_details.rb +82 -67
  340. data/lib/oci/load_balancer/models/update_backend_set_details.rb +80 -70
  341. data/lib/oci/load_balancer/models/update_health_checker_details.rb +108 -108
  342. data/lib/oci/load_balancer/models/update_listener_details.rb +91 -85
  343. data/lib/oci/load_balancer/models/update_load_balancer_details.rb +62 -40
  344. data/lib/oci/load_balancer/models/update_path_route_set_details.rb +60 -38
  345. data/lib/oci/load_balancer/models/work_request.rb +115 -108
  346. data/lib/oci/load_balancer/models/work_request_error.rb +76 -49
  347. data/lib/oci/object_storage/models/bucket.rb +136 -133
  348. data/lib/oci/object_storage/models/bucket_summary.rb +95 -95
  349. data/lib/oci/object_storage/models/commit_multipart_upload_details.rb +66 -48
  350. data/lib/oci/object_storage/models/commit_multipart_upload_part_details.rb +64 -44
  351. data/lib/oci/object_storage/models/create_bucket_details.rb +113 -111
  352. data/lib/oci/object_storage/models/create_multipart_upload_details.rb +80 -70
  353. data/lib/oci/object_storage/models/create_preauthenticated_request_details.rb +87 -74
  354. data/lib/oci/object_storage/models/list_objects.rb +71 -53
  355. data/lib/oci/object_storage/models/multipart_upload.rb +77 -65
  356. data/lib/oci/object_storage/models/multipart_upload_part_summary.rb +72 -56
  357. data/lib/oci/object_storage/models/namespace_metadata.rb +69 -53
  358. data/lib/oci/object_storage/models/object_summary.rb +73 -57
  359. data/lib/oci/object_storage/models/preauthenticated_request.rb +105 -96
  360. data/lib/oci/object_storage/models/preauthenticated_request_summary.rb +99 -86
  361. data/lib/oci/object_storage/models/rename_object_details.rb +80 -74
  362. data/lib/oci/object_storage/models/restore_objects_details.rb +66 -45
  363. data/lib/oci/object_storage/models/update_bucket_details.rb +101 -97
  364. data/lib/oci/object_storage/models/update_namespace_metadata_details.rb +65 -47
  365. data/lib/oci/object_storage/object_storage.rb +2 -0
  366. data/lib/oci/object_storage/object_storage_client.rb +737 -435
  367. data/lib/oci/object_storage/object_storage_client_composite_operations.rb +24 -0
  368. data/lib/oci/signer.rb +20 -7
  369. data/lib/oci/version.rb +1 -1
  370. metadata +13 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 710c56b90571dcc168a349f896579265e90fe8d7
4
- data.tar.gz: 4a77c01309de5a1b22e14b123c4038c5e714f0a1
3
+ metadata.gz: 122d8a6833bc35b30fd21376077be42796aa9aad
4
+ data.tar.gz: dd242ebfcdc8c4d2c5bf8bdba3a1765de19fd80f
5
5
  SHA512:
6
- metadata.gz: 56cda480d05e618cfb517a1b1a13bc9137e13852e789dfdcbc78fab0eedfdabe4c9be1e2a28d342ac119003da1323c987edcee78d7ebc5b15b5b5a03a01769da
7
- data.tar.gz: c47dc6cce662d968890c7b8f5c405db3eee70f70cc5a265cca84c43d35fe8a632cdf9d8757f089c26903d00697c9713c47cf667cc1efc61e4b5d40d43ce727ec
6
+ metadata.gz: f425a54f1c47f002b7260d0de1aa36de516e7205f8d1388f5ade8b64a39e93429341dc0d0bd17e3686a1182f646f6771decc54aefae08aa01c7a01715aea3337
7
+ data.tar.gz: 5988a3c9418b0f107c986e926d673914735602c17223eb886e7e2c1c466f942b550edf92b11e7887c4b00b898c98b4921c2f1ad009e17a5189554a58ab803c10
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Oracle Cloud Infrastructure Ruby SDK
2
- **Version 2.1.0**
2
+ **Version 2.1.1**
3
3
 
4
4
  This topic describes how to install, configure, and use the Oracle Cloud Infrastructure Ruby SDK.
5
5
 
@@ -68,7 +68,15 @@ The following table provides details about some of the attributes of the SDK.
68
68
  </tr>
69
69
  <tr>
70
70
  <td>Waiters</td>
71
- <td>Responses for get requests support waiting for a particular states using {OCI::Response#wait_until wait_until}. See example code later in this file.</td>
71
+ <td>
72
+ Responses for get requests support waiting for a particular states using {OCI::Response#wait_until wait_until}. See example code later in this file.
73
+ <p>
74
+ In addition to using waiters, you can use the CompositeOperation classes in the SDK (e.g. {OCI::Core::ComputeClientCompositeOperations}) to perform
75
+ an action on a resource and wait for it to enter a particular state (or states). The CompositeOperation classes provide convenience methods so that
76
+ you yourself do not have to invoke an operation and then separately invoke a waiter. An example of using the CompositeOperations classes can be found
77
+ in the examples folder of the Ruby SDK <a href="https://docs.us-phoenix-1.oraclecloud.com/tools/ruby/latest/download/oci-ruby-sdk.zip">download</a>
78
+ </p>
79
+ </td>
72
80
  </tr>
73
81
  <tr>
74
82
  <td>HTTP Client</td>
@@ -77,7 +85,7 @@ The following table provides details about some of the attributes of the SDK.
77
85
  <tr>
78
86
  <td>Instance Principals Authentication</td>
79
87
  <td>
80
- The Ruby SDK supports <a href="">Instance Principals</a> authentication via the use of the {OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner} class. An example of using Instance Principals authentication can be found in the examples folder of the Ruby SDK <a href="https://docs.us-phoenix-1.oraclecloud.com/tools/ruby/latest/download/oci-ruby-sdk.zip">download</a>
88
+ The Ruby SDK supports <a href="https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/callingservicesfrominstances.htm">Instance Principals</a> authentication via the use of the {OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner} class. An example of using Instance Principals authentication can be found in the examples folder of the Ruby SDK <a href="https://docs.us-phoenix-1.oraclecloud.com/tools/ruby/latest/download/oci-ruby-sdk.zip">download</a>
81
89
  </td>
82
90
  </tr>
83
91
  <tr>
data/lib/oci.rb CHANGED
@@ -31,6 +31,12 @@ require 'oci/object_storage/transfer/transfer'
31
31
  module OCI
32
32
  class << self
33
33
  attr_accessor :sdk_name
34
+
35
+ # Defines the logger used for debugging for the OCI module.
36
+ # For example, log to STDOUT by setting this to Logger.new(STDOUT).
37
+ #
38
+ # @return [Logger]
39
+ attr_accessor :logger
34
40
  end
35
41
  end
36
42
 
@@ -14,7 +14,27 @@ require_relative 'version'
14
14
  require_relative 'response'
15
15
 
16
16
  module OCI
17
+ # The base API client which contains functionality make requests and receive responses from OCI
18
+ # services. This client also handles request serialization and response deserialization
17
19
  class ApiClient
20
+ class << self
21
+ private
22
+
23
+ def get_rfc339_formatted_date_string_with_z_offset(date_time)
24
+ as_utc = date_time.to_time.utc
25
+
26
+ # Port of the Java SDK behaviour where we omit fractional seconds if they would be 0
27
+ return as_utc.iso8601 if as_utc.strftime('%L').to_i.zero?
28
+ as_utc.iso8601(3)
29
+ end
30
+
31
+ def cgi_escape_query_param(raw_value)
32
+ return CGI.escape(get_rfc339_formatted_date_string_with_z_offset(raw_value)) if raw_value.is_a?(DateTime)
33
+
34
+ CGI.escape(raw_value.to_s)
35
+ end
36
+ end
37
+
18
38
  # Maps collection format types (as per the collectionFormat types described here:
19
39
  # https://swagger.io/docs/specification/2-0/describing-parameters/) to the delimiters
20
40
  # we should use to separate values.
@@ -23,11 +43,13 @@ module OCI
23
43
  # a collection rather than transforming them into a single string
24
44
  VALID_COLLECTION_FORMATS = {
25
45
  multi: nil,
26
- csv: ',',
27
- ssv: ' ',
28
- tsv: "\t", # this is double quoted so it is interpreted as a tab rather than as a literal slash ('\') followed by a 't'
29
- pipes: '|'
30
- }
46
+ csv: ','.freeze,
47
+ ssv: ' '.freeze,
48
+ pipes: '|'.freeze,
49
+
50
+ # this is double quoted so it is interpreted as a tab rather than as a literal slash ('\') followed by a 't'
51
+ tsv: "\t".freeze
52
+ }.freeze
31
53
 
32
54
  # The Config object holding settings to be used in the API client.
33
55
  attr_accessor :config
@@ -61,6 +83,9 @@ module OCI
61
83
  @proxy_settings = proxy_settings
62
84
  end
63
85
 
86
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
87
+
88
+
64
89
  # Call an API with given options.
65
90
  #
66
91
  # @param [Symbol] http_method HTTP method/verb (e.g. :post, :get)
@@ -69,6 +94,7 @@ module OCI
69
94
  # @option opts [Hash] :header_params Header parameters
70
95
  # @option opts [Hash] :query_params Query parameters
71
96
  # @option opts [Hash] :form_params Form parameters
97
+ # @option opts [String] :operation_signing_strategy The signing strategy for the api operation
72
98
  # @option opts [Object] :body HTTP body in JSON
73
99
  # @option [Block] block Allow to receive data from http body as streaming
74
100
  #
@@ -78,8 +104,13 @@ module OCI
78
104
  def call_api(http_method, path, endpoint, opts, &block)
79
105
  http_method = http_method.to_sym.downcase
80
106
 
81
- return call_api_inner(http_method, path, endpoint, opts, &block) if !using_instance_principals? && http_method != :get
82
- return instance_principals_signer_wrapped_call { call_api_inner(http_method, path, endpoint, opts, &block) } if using_instance_principals? && http_method != :get
107
+ if http_method != :get
108
+ return call_api_inner(http_method, path, endpoint, opts, &block) unless using_instance_principals?
109
+
110
+ return instance_principals_signer_wrapped_call do
111
+ call_api_inner(http_method, path, endpoint, opts, &block)
112
+ end
113
+ end
83
114
 
84
115
  # Wrap get calls in a lambda that can be called later for paging
85
116
  # and wait_until.
@@ -93,7 +124,7 @@ module OCI
93
124
  return call_api_inner(http_method, path, endpoint, opts, &block)
94
125
  }
95
126
 
96
- response = proc.call(nil) if !using_instance_principals?
127
+ response = proc.call(nil) unless using_instance_principals?
97
128
  response = instance_principals_signer_wrapped_call { proc.call(nil) } if using_instance_principals?
98
129
 
99
130
  response.api_call = proc
@@ -116,54 +147,132 @@ module OCI
116
147
  # an IO
117
148
  return model.to_io if (model.respond_to?(:read) || model.respond_to?(:write)) && model.respond_to?(:to_io)
118
149
 
119
- if model.is_a?(Array)
120
- local_body = model.map{|m| object_to_hash(m) }
121
- else
122
- local_body = object_to_hash(model)
123
- end
150
+ local_body = if model.is_a?(Array)
151
+ model.map { |m| object_to_hash(m) }
152
+ else
153
+ object_to_hash(model)
154
+ end
155
+
124
156
  local_body.to_json
125
157
  end
158
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
126
159
 
127
160
  # Builds the client info string to be sent with each request.
128
161
  def build_request_id
129
- return SecureRandom.uuid.gsub!('-', '').upcase
162
+ SecureRandom.uuid.delete!('-').upcase
130
163
  end
131
164
 
132
165
  # Builds the client info string to be sent with each request.
133
166
  def build_user_info
134
- return "Oracle-RubySDK/#{VERSION}"
167
+ "Oracle-RubySDK/#{VERSION}"
135
168
  end
136
169
 
137
170
  # Build the user agent string to be send with each request.
138
171
  def build_user_agent
139
172
  agent = "#{build_user_info}#{OCI.sdk_name} (ruby #{RUBY_VERSION}; #{RUBY_PLATFORM})"
140
-
141
- if config.additional_user_agent
142
- agent = "#{agent} #{config.additional_user_agent}"
143
- end
173
+ agent = "#{agent} #{config.additional_user_agent}" if config.additional_user_agent
144
174
 
145
175
  agent
146
176
  end
147
177
 
148
178
  def self.build_collection_params(collection, collection_format)
149
- if collection_format.nil? || !VALID_COLLECTION_FORMATS.has_key?(collection_format.to_sym)
179
+ if collection_format.nil? || !VALID_COLLECTION_FORMATS.key?(collection_format.to_sym)
150
180
  raise "Invalid collection_format: #{collection_format}. Must be one of: #{VALID_COLLECTION_FORMATS.keys}"
151
181
  end
152
182
 
153
- if collection_format == :multi
154
- return collection
155
- else
156
- return collection.join(VALID_COLLECTION_FORMATS[collection_format.to_sym])
183
+ return collection if collection_format == :multi
184
+
185
+ collection.join(VALID_COLLECTION_FORMATS[collection_format.to_sym])
186
+ end
187
+
188
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
189
+
190
+
191
+ def self.append_query_params(url, query_params)
192
+ return url if query_params.empty?
193
+
194
+ # First divide our query params into ones where the param value is a simple value (e.g. a string), an array or a hash.
195
+ # The params where the value is a hash are, for example, tags we need to handle differently for inclusion in the query
196
+ # string. We also need to handle array params differently in the query string since the values should appear as separate entries
197
+ # in the query string with the same key (this corresponds to using collectionFormat=multi in Swagger)
198
+ #
199
+ # An example query_params is:
200
+ #
201
+ # {
202
+ # "stuff" => "things",
203
+ # "anArrayType" => ["hello", "world"]
204
+ # "definedTags" => { "tag1" => ["val1", "val2", "val3"], "tag2" => ["val1"] },
205
+ # "definedTagsExists" => { "tag3" => true, "tag4" => true }
206
+ # }
207
+ #
208
+ # So our simple_params will be: { "stuff" => "things" }
209
+ # And our array_params will be: { "anArrayType" => ["hello", "world"]}
210
+ # And our hash_params will be: { "definedTags" => { "tag1" => ["val1", "val2", "val3"], "tag2" => ["val1"] }, "definedTagsExists" => { "tag3" => true, "tag4" => true } }
211
+ simple_params = query_params.select { |_k, v| !v.is_a?(Hash) && !v.is_a?(Array) }.to_h
212
+ array_params = query_params.select { |_k, v| v.is_a?(Array) }.to_h
213
+ hash_params = query_params.select { |_k, v| v.is_a?(Hash) }.to_h
214
+
215
+ # Simple params just go key to value
216
+ base_query_string = ''
217
+
218
+ unless simple_params.empty?
219
+ base_query_string << simple_params.map { |k, v| "#{k}=#{cgi_escape_query_param(v)}" }.join('&')
220
+ end
221
+
222
+ # Using the previous comment:
223
+ # k = "anArrayType", v = ["hello", "world"]
224
+ #
225
+ # And we want query string params like #{k}=#{v[0]}&#{k}=#{v[1]}&#{k}=#{v[2]}...
226
+ # So the same key is repeated, but each value is a different value from the array
227
+ array_params.each do |k, v|
228
+ v.each do |query_string_val|
229
+ base_query_string << '&' unless base_query_string.empty?
230
+ base_query_string << "#{k}=#{cgi_escape_query_param(query_string_val)}"
231
+ end
232
+ end
233
+
234
+ # Using the previous comment:
235
+ # k = "definedTags", v = { "tag1" => [...] }
236
+ #
237
+ # Hash params are exploded as follows:
238
+ #
239
+ # - If value in v is an array then we explode the content like: #{k}.#{v.key}=#{v.value[0]}&#{k}.#{v.key}=#{v.value[1]}&... so that there is
240
+ # one query string parameter per item in the array
241
+ # - If value in v is not an array then we explode the content like: #{k}.#{v.key}=#{v.value}
242
+ hash_params.each do |k, v|
243
+ v.each do |tag_key, tag_val|
244
+ # TODO: Should this be ERB::Util.url_encode instead? CGI.escape gives "+" here but url_encode will give %20
245
+ # CGI.escape is what we've been using until now, and it looks like it works...A literal "+" in the string will
246
+ # be encoded to %2B
247
+ query_string_val = if tag_val.is_a?(Array)
248
+ # to_s tag_key to avoid errors around implicit conversion of symbols to strings
249
+ tag_val.map do |tv|
250
+ "#{k}.#{cgi_escape_query_param(tag_key)}=#{cgi_escape_query_param(tv)}"
251
+ end.join('&')
252
+ else
253
+ "#{k}.#{cgi_escape_query_param(tag_key)}=#{cgi_escape_query_param(tag_val)}"
254
+ end
255
+ base_query_string << '&' unless base_query_string.empty?
256
+ base_query_string << query_string_val
257
+ end
157
258
  end
259
+
260
+ url << '?' unless base_query_string.empty?
261
+ url << base_query_string
262
+
263
+ url
158
264
  end
265
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
159
266
 
160
267
  private
161
268
 
269
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
162
270
  def call_api_inner(http_method, path, endpoint, opts, &block)
163
271
  query_params = opts[:query_params] || {}
164
272
  header_params = @default_headers.merge(opts[:header_params] || {})
165
273
  form_params = opts[:form_params] || {}
166
274
  body = opts[:body] || nil
275
+ operation_signing_strategy = opts[:operation_signing_strategy] || nil
167
276
 
168
277
  url = ApiClient.append_query_params(build_request_url(path, endpoint), query_params)
169
278
  uri = URI(url)
@@ -189,18 +298,13 @@ module OCI
189
298
  if body.respond_to?(:read) && body.respond_to?(:write)
190
299
  request.body_stream = body
191
300
  else
192
- if %i[post, put, delete, patch].include?(http_method)
193
- body = build_request_body(header_params, form_params, body)
194
- end
195
-
301
+ body = build_request_body(header_params, form_params, body) if %i[post put delete patch].include?(http_method)
196
302
  request.body = body
197
303
  end
198
304
 
199
- if @config.logger
200
- @config.logger.debug "HTTP request body param ~BEGIN~\n#{body}\n~END~\n"
201
- end
305
+ @config.logger.debug "HTTP request body param ~BEGIN~\n#{body}\n~END~\n" if @config.logger
202
306
 
203
- @signer.sign(http_method, url, header_params, body)
307
+ @signer.sign(http_method, url, header_params, body, operation_signing_strategy)
204
308
 
205
309
  header_params.each do |key, value|
206
310
  request[key.to_s] = value
@@ -214,8 +318,8 @@ module OCI
214
318
 
215
319
  unless @request_option_overrides.empty?
216
320
  http.methods.grep(/\A(\w+)=\z/) do |meth|
217
- key = $1.to_sym
218
- @request_option_overrides.key?(key) or next
321
+ key = Regexp.last_match(1).to_sym
322
+ @request_option_overrides.key?(key) || next
219
323
  http.__send__(meth, @request_option_overrides[key])
220
324
  end
221
325
  end
@@ -277,6 +381,7 @@ module OCI
277
381
  return handle_success_response(request, response_ref, opts[:return_type]) if success?(response_ref)
278
382
  handle_non_success_response(request, response_ref)
279
383
  end
384
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
280
385
 
281
386
  def get_http_object(hostname, port)
282
387
  return Net::HTTP.new(hostname, port) if @proxy_settings.nil?
@@ -313,9 +418,7 @@ module OCI
313
418
  processed_keys = {}
314
419
 
315
420
  response.each_header do |key, value|
316
- if key.start_with?(prefix)
317
- processed_keys[key[prefix_size..-1]] = value
318
- end
421
+ processed_keys[key[prefix_size..-1]] = value if key.start_with?(prefix)
319
422
  end
320
423
 
321
424
  processed_keys.each do |key, value|
@@ -348,12 +451,16 @@ module OCI
348
451
  def handle_success_response(request, response, return_type)
349
452
  data = return_type ? deserialize(request, response, return_type) : nil
350
453
 
351
- @config.logger.debug("API Response Received:\nData: #{data.inspect}\nStatus code: #{response.code}\nHeaders: #{response.header}") \
352
- if @config.logger
454
+ if @config.logger
455
+ @config.logger.debug(
456
+ "API Response Received:\nData: #{data.inspect}\nStatus code: #{response.code}\nHeaders: #{response.header}"
457
+ )
458
+ end
353
459
 
354
460
  Response.new(response.code.to_i, response.header, data)
355
461
  end
356
462
 
463
+ # rubocop:disable Metrics/AbcSize
357
464
  def handle_non_success_response(request, response)
358
465
  # For errors, we expect a plain JSON object so pass 'Object' here in order to serialize it into a hash
359
466
  data = deserialize(request, response, 'Object')
@@ -384,78 +491,7 @@ module OCI
384
491
  )
385
492
  end
386
493
  end
387
-
388
- def self.append_query_params(url, query_params)
389
- if query_params.empty?
390
- url
391
- else
392
- # First divide our query params into ones where the param value is a simple value (e.g. a string), an array or a hash.
393
- # The params where the value is a hash are, for example, tags we need to handle differently for inclusion in the query
394
- # string. We also need to handle array params differently in the query string since the values should appear as separate entries
395
- # in the query string with the same key (this corresponds to using collectionFormat=multi in Swagger)
396
- #
397
- # An example query_params is:
398
- #
399
- # {
400
- # "stuff" => "things",
401
- # "anArrayType" => ["hello", "world"]
402
- # "definedTags" => { "tag1" => ["val1", "val2", "val3"], "tag2" => ["val1"] },
403
- # "definedTagsExists" => { "tag3" => true, "tag4" => true }
404
- # }
405
- #
406
- # So our simple_params will be: { "stuff" => "things" }
407
- # And our array_params will be: { "anArrayType" => ["hello", "world"]}
408
- # And our hash_params will be: { "definedTags" => { "tag1" => ["val1", "val2", "val3"], "tag2" => ["val1"] }, "definedTagsExists" => { "tag3" => true, "tag4" => true } }
409
- simple_params = query_params.select { |k,v| !v.is_a?(Hash) && !v.is_a?(Array) }.to_h
410
- array_params = query_params.select { |k,v| v.is_a?(Array) }.to_h
411
- hash_params = query_params.select { |k,v| v.is_a?(Hash) }.to_h
412
-
413
- # Simple params just go key to value
414
- base_query_string = ''
415
- base_query_string << simple_params.map{|k,v| "#{k}=#{self.cgi_escape_query_param(v)}"}.join('&') unless simple_params.empty?
416
-
417
- # Using the previous comment:
418
- # k = "anArrayType", v = ["hello", "world"]
419
- #
420
- # And we want query string params like #{k}=#{v[0]}&#{k}=#{v[1]}&#{k}=#{v[2]}...
421
- # So the same key is repeated, but each value is a different value from the array
422
- array_params.each do |k,v|
423
- v.each do |query_string_val|
424
- base_query_string << '&' unless base_query_string.empty?
425
- base_query_string << "#{k}=#{self.cgi_escape_query_param(query_string_val)}"
426
- end
427
- end
428
-
429
- # Using the previous comment:
430
- # k = "definedTags", v = { "tag1" => [...] }
431
- #
432
- # Hash params are exploded as follows:
433
- #
434
- # - If value in v is an array then we explode the content like: #{k}.#{v.key}=#{v.value[0]}&#{k}.#{v.key}=#{v.value[1]}&... so that there is
435
- # one query string parameter per item in the array
436
- # - If value in v is not an array then we explode the content like: #{k}.#{v.key}=#{v.value}
437
- hash_params.each do |k,v|
438
- v.each do |tag_key, tag_val|
439
- # TODO: Should this be ERB::Util.url_encode instead? CGI.escape gives "+" here but url_encode will give %20
440
- # CGI.escape is what we've been using until now, and it looks like it works...A literal "+" in the string will
441
- # be encoded to %2B
442
- query_string_val = if tag_val.is_a?(Array)
443
- # to_s tag_key to avoid errors around implicit conversion of symbols to strings
444
- tag_val.map { |tv| "#{k}.#{self.cgi_escape_query_param(tag_key)}=#{self.cgi_escape_query_param(tv)}" }.join('&')
445
- else
446
- "#{k}.#{self.cgi_escape_query_param(tag_key)}=#{self.cgi_escape_query_param(tag_val)}"
447
- end
448
- base_query_string << '&' unless base_query_string.empty?
449
- base_query_string << query_string_val
450
- end
451
- end
452
-
453
- url << '?' unless base_query_string.empty?
454
- url << base_query_string
455
-
456
- url
457
- end
458
- end
494
+ # rubocop:enable Metrics/AbcSize
459
495
 
460
496
  # Check if the given MIME is a JSON MIME.
461
497
  # JSON MIME examples:
@@ -468,6 +504,9 @@ module OCI
468
504
  !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
469
505
  end
470
506
 
507
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
508
+
509
+
471
510
  # Deserialize the response to the given return type.
472
511
  #
473
512
  # @param [Response] response HTTP response
@@ -494,9 +533,9 @@ module OCI
494
533
  end
495
534
 
496
535
  begin
497
- data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
536
+ data = JSON.parse("[#{body}]", symbolize_names: true)[0]
498
537
  rescue JSON::ParserError
499
- if %w(String Date DateTime).include?(return_type)
538
+ if %w[String Date DateTime].include?(return_type)
500
539
  data = body
501
540
  else
502
541
  # If we received an error here then we received a response from the OCI service that
@@ -522,15 +561,16 @@ module OCI
522
561
 
523
562
  OCI::Internal::Util.convert_to_type return_type, data
524
563
  end
564
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
525
565
 
526
566
  def build_request_url(path, endpoint)
527
567
  # Add leading and trailing slashes to path
528
568
  path = "/#{path}".gsub(/\/+/, '/')
569
+ endpoint = endpoint.chop if endpoint.end_with? '/'
529
570
 
530
- if endpoint.end_with? '/'
531
- endpoint = endpoint.chop
532
- end
571
+ # rubocop:disable Lint/UriEscapeUnescape
533
572
  URI.encode(endpoint + path)
573
+ # rubocop:enable Lint/UriEscapeUnescape
534
574
  end
535
575
 
536
576
  # Builds the HTTP request body
@@ -542,7 +582,8 @@ module OCI
542
582
  def build_request_body(header_params, form_params, body)
543
583
  # http form
544
584
  if header_params['content-type'] == 'application/x-www-form-urlencoded' ||
545
- header_params['content-type'] == 'multipart/form-data'
585
+ header_params['content-type'] == 'multipart/form-data'
586
+
546
587
  data = {}
547
588
  form_params.each do |key, value|
548
589
  case value
@@ -583,7 +624,7 @@ module OCI
583
624
  begin
584
625
  return yield
585
626
  rescue OCI::Errors::ServiceError => e
586
- raise if attempt >= (max_attempts - 1) # .times is zero-based
627
+ raise if attempt >= (max_attempts - 1) # .times is zero-based
587
628
  raise if e.status != 401
588
629
 
589
630
  @signer.refresh_security_token
@@ -591,21 +632,5 @@ module OCI
591
632
  end
592
633
  end
593
634
  end
594
-
595
- def self.get_rfc339_formatted_date_string_with_z_offset(date_time)
596
- as_utc = date_time.to_time.utc
597
-
598
- # Port of the Java SDK behaviour where we omit fractional seconds if they would be 0
599
- return as_utc.iso8601() if as_utc.strftime('%L').to_i == 0
600
- as_utc.iso8601(3)
601
- end
602
-
603
- def self.cgi_escape_query_param(raw_value)
604
- if raw_value.is_a?(DateTime)
605
- CGI.escape(get_rfc339_formatted_date_string_with_z_offset(raw_value))
606
- else
607
- CGI.escape(raw_value.to_s)
608
- end
609
- end
610
635
  end
611
636
  end