oci 2.5.10 → 2.5.11

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 (225) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/lib/oci.rb +3 -0
  4. data/lib/oci/budget/budget.rb +1 -0
  5. data/lib/oci/budget/budget_client.rb +21 -1
  6. data/lib/oci/budget/models/budget.rb +52 -2
  7. data/lib/oci/budget/models/budget_summary.rb +52 -2
  8. data/lib/oci/budget/models/create_budget_details.rb +55 -2
  9. data/lib/oci/budget/models/target_type.rb +10 -0
  10. data/lib/oci/core/blockstorage_client.rb +18 -6
  11. data/lib/oci/core/compute_client.rb +75 -0
  12. data/lib/oci/core/compute_management_client.rb +4 -1
  13. data/lib/oci/core/core.rb +12 -0
  14. data/lib/oci/core/models/add_security_rule_details.rb +2 -2
  15. data/lib/oci/core/models/boot_volume_backup.rb +19 -1
  16. data/lib/oci/core/models/change_boot_volume_backup_compartment_details.rb +2 -2
  17. data/lib/oci/core/models/change_boot_volume_compartment_details.rb +2 -2
  18. data/lib/oci/core/models/change_cpe_compartment_details.rb +155 -0
  19. data/lib/oci/core/models/change_cross_connect_compartment_details.rb +155 -0
  20. data/lib/oci/core/models/change_cross_connect_group_compartment_details.rb +155 -0
  21. data/lib/oci/core/models/change_instance_compartment_details.rb +154 -0
  22. data/lib/oci/core/models/change_ip_sec_connection_compartment_details.rb +155 -0
  23. data/lib/oci/core/models/change_remote_peering_connection_compartment_details.rb +155 -0
  24. data/lib/oci/core/models/change_virtual_circuit_compartment_details.rb +155 -0
  25. data/lib/oci/core/models/change_volume_backup_compartment_details.rb +2 -2
  26. data/lib/oci/core/models/change_volume_compartment_details.rb +2 -2
  27. data/lib/oci/core/models/change_volume_group_backup_compartment_details.rb +2 -2
  28. data/lib/oci/core/models/change_volume_group_compartment_details.rb +2 -2
  29. data/lib/oci/core/models/copy_volume_backup_details.rb +27 -4
  30. data/lib/oci/core/models/create_cross_connect_details.rb +37 -1
  31. data/lib/oci/core/models/create_cross_connect_group_details.rb +40 -4
  32. data/lib/oci/core/models/create_instance_configuration_base.rb +250 -0
  33. data/lib/oci/core/models/create_instance_configuration_details.rb +15 -57
  34. data/lib/oci/core/models/create_instance_configuration_from_instance_details.rb +179 -0
  35. data/lib/oci/core/models/create_ipv6_details.rb +249 -0
  36. data/lib/oci/core/models/create_remote_peering_connection_details.rb +40 -4
  37. data/lib/oci/core/models/create_service_gateway_details.rb +23 -1
  38. data/lib/oci/core/models/create_subnet_details.rb +24 -1
  39. data/lib/oci/core/models/create_vcn_details.rb +56 -4
  40. data/lib/oci/core/models/create_virtual_circuit_details.rb +38 -2
  41. data/lib/oci/core/models/cross_connect.rb +37 -1
  42. data/lib/oci/core/models/cross_connect_group.rb +37 -1
  43. data/lib/oci/core/models/cross_connect_mapping.rb +50 -1
  44. data/lib/oci/core/models/egress_security_rule.rb +10 -7
  45. data/lib/oci/core/models/ingress_security_rule.rb +10 -7
  46. data/lib/oci/core/models/instance.rb +1 -0
  47. data/lib/oci/core/models/ipv6.rb +375 -0
  48. data/lib/oci/core/models/private_ip.rb +1 -0
  49. data/lib/oci/core/models/remote_peering_connection.rb +37 -1
  50. data/lib/oci/core/models/route_rule.rb +4 -1
  51. data/lib/oci/core/models/security_rule.rb +2 -2
  52. data/lib/oci/core/models/service_gateway.rb +18 -1
  53. data/lib/oci/core/models/subnet.rb +56 -1
  54. data/lib/oci/core/models/update_cross_connect_details.rb +37 -1
  55. data/lib/oci/core/models/update_cross_connect_group_details.rb +40 -4
  56. data/lib/oci/core/models/update_ipv6_details.rb +229 -0
  57. data/lib/oci/core/models/update_remote_peering_connection_details.rb +40 -4
  58. data/lib/oci/core/models/update_security_rule_details.rb +2 -2
  59. data/lib/oci/core/models/update_service_gateway_details.rb +18 -1
  60. data/lib/oci/core/models/update_virtual_circuit_details.rb +37 -1
  61. data/lib/oci/core/models/vcn.rb +42 -1
  62. data/lib/oci/core/models/virtual_circuit.rb +37 -1
  63. data/lib/oci/core/models/volume_backup.rb +19 -1
  64. data/lib/oci/core/virtual_network_client.rb +744 -10
  65. data/lib/oci/core/virtual_network_client_composite_operations.rb +119 -0
  66. data/lib/oci/database/database.rb +3 -0
  67. data/lib/oci/database/database_client.rb +320 -36
  68. data/lib/oci/database/models/autonomous_data_warehouse.rb +1 -0
  69. data/lib/oci/database/models/autonomous_data_warehouse_console_token_details.rb +164 -0
  70. data/lib/oci/database/models/autonomous_data_warehouse_summary.rb +1 -0
  71. data/lib/oci/database/models/autonomous_database.rb +5 -3
  72. data/lib/oci/database/models/autonomous_database_connection_urls.rb +1 -1
  73. data/lib/oci/database/models/autonomous_database_console_token_details.rb +163 -0
  74. data/lib/oci/database/models/autonomous_database_summary.rb +5 -3
  75. data/lib/oci/database/models/autonomous_db_preview_version_summary.rb +1 -3
  76. data/lib/oci/database/models/change_compartment_details.rb +155 -0
  77. data/lib/oci/database/models/create_autonomous_database_base.rb +5 -4
  78. data/lib/oci/database/models/create_data_guard_association_with_new_db_system_details.rb +2 -5
  79. data/lib/oci/database/models/create_database_details.rb +1 -1
  80. data/lib/oci/database/models/create_db_home_with_db_system_id_details.rb +2 -1
  81. data/lib/oci/database/models/create_db_home_with_db_system_id_from_backup_details.rb +2 -1
  82. data/lib/oci/database/models/db_system.rb +2 -5
  83. data/lib/oci/database/models/db_system_summary.rb +2 -5
  84. data/lib/oci/database/models/launch_db_system_base.rb +3 -5
  85. data/lib/oci/database/models/maintenance_window.rb +2 -1
  86. data/lib/oci/database/models/update_autonomous_database_details.rb +5 -3
  87. data/lib/oci/database/models/update_db_system_details.rb +2 -5
  88. data/lib/oci/dns/dns.rb +2 -0
  89. data/lib/oci/dns/dns_client.rb +138 -1
  90. data/lib/oci/dns/models/change_steering_policy_compartment_details.rb +155 -0
  91. data/lib/oci/dns/models/change_zone_compartment_details.rb +155 -0
  92. data/lib/oci/events/events.rb +34 -0
  93. data/lib/oci/events/events_client.rb +537 -0
  94. data/lib/oci/events/events_client_composite_operations.rb +145 -0
  95. data/lib/oci/events/models/action.rb +275 -0
  96. data/lib/oci/events/models/action_details.rb +222 -0
  97. data/lib/oci/events/models/action_details_list.rb +150 -0
  98. data/lib/oci/events/models/action_list.rb +151 -0
  99. data/lib/oci/events/models/change_rule_compartment_details.rb +156 -0
  100. data/lib/oci/events/models/create_faa_s_action_details.rb +170 -0
  101. data/lib/oci/events/models/create_notification_service_action_details.rb +170 -0
  102. data/lib/oci/events/models/create_rule_details.rb +284 -0
  103. data/lib/oci/events/models/create_streaming_service_action_details.rb +170 -0
  104. data/lib/oci/events/models/faa_s_action.rb +178 -0
  105. data/lib/oci/events/models/notification_service_action.rb +179 -0
  106. data/lib/oci/events/models/rule.rb +372 -0
  107. data/lib/oci/events/models/rule_summary.rb +321 -0
  108. data/lib/oci/events/models/streaming_service_action.rb +178 -0
  109. data/lib/oci/events/models/update_rule_details.rb +266 -0
  110. data/lib/oci/events/util.rb +2 -0
  111. data/lib/oci/functions/functions.rb +29 -0
  112. data/lib/oci/functions/functions_invoke_client.rb +237 -0
  113. data/lib/oci/functions/functions_invoke_client_composite_operations.rb +24 -0
  114. data/lib/oci/functions/functions_management_client.rb +851 -0
  115. data/lib/oci/functions/functions_management_client_composite_operations.rb +266 -0
  116. data/lib/oci/functions/models/application.rb +322 -0
  117. data/lib/oci/functions/models/application_summary.rb +281 -0
  118. data/lib/oci/functions/models/change_application_compartment_details.rb +156 -0
  119. data/lib/oci/functions/models/create_application_details.rb +236 -0
  120. data/lib/oci/functions/models/create_function_details.rb +280 -0
  121. data/lib/oci/functions/models/function.rb +397 -0
  122. data/lib/oci/functions/models/function_summary.rb +381 -0
  123. data/lib/oci/functions/models/update_application_details.rb +191 -0
  124. data/lib/oci/functions/models/update_function_details.rb +250 -0
  125. data/lib/oci/functions/util.rb +2 -0
  126. data/lib/oci/healthchecks/health_checks_client.rb +147 -1
  127. data/lib/oci/healthchecks/healthchecks.rb +2 -0
  128. data/lib/oci/healthchecks/models/change_http_monitor_compartment_details.rb +155 -0
  129. data/lib/oci/healthchecks/models/change_ping_monitor_compartment_details.rb +155 -0
  130. data/lib/oci/healthchecks/models/create_http_monitor_details.rb +2 -1
  131. data/lib/oci/healthchecks/models/create_on_demand_http_probe_details.rb +2 -1
  132. data/lib/oci/healthchecks/models/create_on_demand_ping_probe_details.rb +2 -1
  133. data/lib/oci/healthchecks/models/create_ping_monitor_details.rb +2 -1
  134. data/lib/oci/healthchecks/models/http_monitor.rb +2 -0
  135. data/lib/oci/healthchecks/models/http_probe.rb +2 -0
  136. data/lib/oci/healthchecks/models/ping_monitor.rb +2 -0
  137. data/lib/oci/healthchecks/models/ping_probe.rb +2 -0
  138. data/lib/oci/healthchecks/models/update_http_monitor_details.rb +2 -0
  139. data/lib/oci/healthchecks/models/update_ping_monitor_details.rb +2 -0
  140. data/lib/oci/identity/identity.rb +1 -0
  141. data/lib/oci/identity/identity_client.rb +70 -0
  142. data/lib/oci/identity/identity_client_composite_operations.rb +50 -0
  143. data/lib/oci/identity/models/move_compartment_details.rb +155 -0
  144. data/lib/oci/key_management/key_management.rb +2 -0
  145. data/lib/oci/key_management/kms_management_client.rb +73 -0
  146. data/lib/oci/key_management/kms_vault_client.rb +73 -0
  147. data/lib/oci/key_management/models/change_key_compartment_details.rb +153 -0
  148. data/lib/oci/key_management/models/change_vault_compartment_details.rb +153 -0
  149. data/lib/oci/key_management/models/key.rb +1 -0
  150. data/lib/oci/key_management/models/key_summary.rb +1 -0
  151. data/lib/oci/key_management/models/vault.rb +1 -0
  152. data/lib/oci/key_management/models/vault_summary.rb +1 -0
  153. data/lib/oci/limits/limits.rb +23 -0
  154. data/lib/oci/limits/models/create_quota_details.rb +220 -0
  155. data/lib/oci/limits/models/quota.rb +287 -0
  156. data/lib/oci/limits/models/quota_summary.rb +273 -0
  157. data/lib/oci/limits/models/update_quota_details.rb +194 -0
  158. data/lib/oci/limits/quotas_client.rb +439 -0
  159. data/lib/oci/limits/quotas_client_composite_operations.rb +143 -0
  160. data/lib/oci/limits/util.rb +2 -0
  161. data/lib/oci/load_balancer/load_balancer.rb +9 -0
  162. data/lib/oci/load_balancer/load_balancer_client.rb +139 -0
  163. data/lib/oci/load_balancer/load_balancer_client_composite_operations.rb +50 -0
  164. data/lib/oci/load_balancer/models/allow_rule.rb +181 -0
  165. data/lib/oci/load_balancer/models/backend_set.rb +21 -4
  166. data/lib/oci/load_balancer/models/backend_set_details.rb +21 -4
  167. data/lib/oci/load_balancer/models/change_load_balancer_compartment_details.rb +156 -0
  168. data/lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb +205 -0
  169. data/lib/oci/load_balancer/models/create_backend_set_details.rb +21 -4
  170. data/lib/oci/load_balancer/models/create_load_balancer_details.rb +37 -1
  171. data/lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb +334 -0
  172. data/lib/oci/load_balancer/models/listener_rule_summary.rb +166 -0
  173. data/lib/oci/load_balancer/models/rule.rb +4 -0
  174. data/lib/oci/load_balancer/models/rule_condition.rb +192 -0
  175. data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +6 -0
  176. data/lib/oci/load_balancer/models/source_ip_address_condition.rb +167 -0
  177. data/lib/oci/load_balancer/models/source_vcn_id_condition.rb +169 -0
  178. data/lib/oci/load_balancer/models/source_vcn_ip_address_condition.rb +171 -0
  179. data/lib/oci/load_balancer/models/update_backend_set_details.rb +21 -4
  180. data/lib/oci/monitoring/models/alarm.rb +4 -3
  181. data/lib/oci/monitoring/models/alarm_summary.rb +4 -3
  182. data/lib/oci/monitoring/models/change_alarm_compartment_details.rb +155 -0
  183. data/lib/oci/monitoring/models/create_alarm_details.rb +4 -3
  184. data/lib/oci/monitoring/models/datapoint.rb +1 -1
  185. data/lib/oci/monitoring/models/list_metrics_details.rb +4 -4
  186. data/lib/oci/monitoring/models/metric_data.rb +14 -0
  187. data/lib/oci/monitoring/models/metric_data_details.rb +6 -4
  188. data/lib/oci/monitoring/models/summarize_metrics_data_details.rb +3 -0
  189. data/lib/oci/monitoring/models/update_alarm_details.rb +4 -3
  190. data/lib/oci/monitoring/monitoring.rb +1 -0
  191. data/lib/oci/monitoring/monitoring_client.rb +140 -5
  192. data/lib/oci/ons/models/backoff_retry_policy.rb +2 -2
  193. data/lib/oci/ons/models/change_compartment_details.rb +156 -0
  194. data/lib/oci/ons/models/confirmation_result.rb +5 -6
  195. data/lib/oci/ons/models/create_topic_details.rb +1 -1
  196. data/lib/oci/ons/models/notification_topic.rb +2 -2
  197. data/lib/oci/ons/models/notification_topic_summary.rb +2 -2
  198. data/lib/oci/ons/models/subscription.rb +47 -4
  199. data/lib/oci/ons/models/subscription_summary.rb +19 -3
  200. data/lib/oci/ons/notification_control_plane_client.rb +95 -8
  201. data/lib/oci/ons/notification_data_plane_client.rb +109 -8
  202. data/lib/oci/ons/ons.rb +1 -0
  203. data/lib/oci/regions.rb +3 -0
  204. data/lib/oci/streaming/models/change_stream_compartment_details.rb +155 -0
  205. data/lib/oci/streaming/stream_admin_client.rb +58 -0
  206. data/lib/oci/streaming/streaming.rb +1 -0
  207. data/lib/oci/version.rb +1 -1
  208. data/lib/oci/waas/models/access_rule_criteria.rb +14 -2
  209. data/lib/oci/waas/models/change_certificate_compartment_details.rb +154 -0
  210. data/lib/oci/waas/models/change_waas_policy_compartment_details.rb +154 -0
  211. data/lib/oci/waas/models/create_certificate_details.rb +2 -2
  212. data/lib/oci/waas/models/protection_rule_exclusion.rb +16 -1
  213. data/lib/oci/waas/models/protection_settings.rb +9 -5
  214. data/lib/oci/waas/models/waas_policy.rb +1 -1
  215. data/lib/oci/waas/models/waf_config_details.rb +8 -8
  216. data/lib/oci/waas/models/waf_log.rb +40 -19
  217. data/lib/oci/waas/waas.rb +2 -0
  218. data/lib/oci/waas/waas_client.rb +155 -27
  219. data/lib/oci/work_requests/models/work_request.rb +14 -8
  220. data/lib/oci/work_requests/models/work_request_error.rb +3 -3
  221. data/lib/oci/work_requests/models/work_request_log_entry.rb +2 -2
  222. data/lib/oci/work_requests/models/work_request_resource.rb +9 -7
  223. data/lib/oci/work_requests/models/work_request_summary.rb +12 -6
  224. data/lib/oci/work_requests/work_request_client.rb +33 -16
  225. metadata +81 -2
@@ -0,0 +1,145 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
4
+ module OCI
5
+ # This class provides a wrapper around {OCI::Events::EventsClient} and offers convenience methods
6
+ # for operations that would otherwise need to be chained together. For example, instead of performing an action
7
+ # on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource
8
+ # to enter a given state, you can call a single method in this class to accomplish the same functionality
9
+ class Events::EventsClientCompositeOperations
10
+ # The {OCI::Events::EventsClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::Events::EventsClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new EventsClientCompositeOperations
16
+ #
17
+ # @param [OCI::Events::EventsClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::Events::EventsClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::Events::EventsClient.new)
20
+ @service_client = service_client
21
+ end
22
+
23
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
24
+ # rubocop:disable Layout/EmptyLines
25
+
26
+
27
+ # Calls {OCI::Events::EventsClient#create_rule} and then waits for the {OCI::Events::Models::Rule} acted upon
28
+ # to enter the given state(s).
29
+ #
30
+ # @param [OCI::Events::Models::CreateRuleDetails] create_rule_details Specification of the rule to create
31
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Events::Models::Rule#lifecycle_state}
32
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Events::EventsClient#create_rule}
33
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
34
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
35
+ # * max_wait_seconds The maximum time to wait, in seconds
36
+ #
37
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Events::Models::Rule}
38
+ def create_rule_and_wait_for_state(create_rule_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
39
+ operation_result = @service_client.create_rule(create_rule_details, base_operation_opts)
40
+
41
+ return operation_result if wait_for_states.empty?
42
+
43
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
44
+ wait_for_resource_id = operation_result.data.id
45
+
46
+ begin
47
+ waiter_result = @service_client.get_rule(wait_for_resource_id).wait_until(
48
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
49
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
50
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
51
+ )
52
+ result_to_return = waiter_result
53
+
54
+ return result_to_return
55
+ rescue StandardError
56
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
57
+ end
58
+ end
59
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
60
+ # rubocop:enable Layout/EmptyLines
61
+
62
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
63
+ # rubocop:disable Layout/EmptyLines
64
+
65
+
66
+ # Calls {OCI::Events::EventsClient#delete_rule} and then waits for the {OCI::Events::Models::Rule} acted upon
67
+ # to enter the given state(s).
68
+ #
69
+ # @param [String] rule_id The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of this rule.
70
+ #
71
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Events::Models::Rule#lifecycle_state}
72
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Events::EventsClient#delete_rule}
73
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
74
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
75
+ # * max_wait_seconds The maximum time to wait, in seconds
76
+ #
77
+ # @return [OCI::Response] A {OCI::Response} object with data of type nil
78
+ def delete_rule_and_wait_for_state(rule_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
79
+ initial_get_result = @service_client.get_rule(rule_id)
80
+ operation_result = @service_client.delete_rule(rule_id, base_operation_opts)
81
+
82
+ return operation_result if wait_for_states.empty?
83
+
84
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
85
+
86
+ begin
87
+ waiter_result = initial_get_result.wait_until(
88
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
89
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
90
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
91
+ succeed_on_not_found: true
92
+ )
93
+ result_to_return = waiter_result
94
+
95
+ return result_to_return
96
+ rescue StandardError
97
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
98
+ end
99
+ end
100
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
101
+ # rubocop:enable Layout/EmptyLines
102
+
103
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
104
+ # rubocop:disable Layout/EmptyLines
105
+
106
+
107
+ # Calls {OCI::Events::EventsClient#update_rule} and then waits for the {OCI::Events::Models::Rule} acted upon
108
+ # to enter the given state(s).
109
+ #
110
+ # @param [String] rule_id The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of this rule.
111
+ #
112
+ # @param [OCI::Events::Models::UpdateRuleDetails] update_rule_details The new rule spec to apply
113
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Events::Models::Rule#lifecycle_state}
114
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Events::EventsClient#update_rule}
115
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
116
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
117
+ # * max_wait_seconds The maximum time to wait, in seconds
118
+ #
119
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Events::Models::Rule}
120
+ def update_rule_and_wait_for_state(rule_id, update_rule_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
121
+ operation_result = @service_client.update_rule(rule_id, update_rule_details, base_operation_opts)
122
+
123
+ return operation_result if wait_for_states.empty?
124
+
125
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
126
+ wait_for_resource_id = operation_result.data.id
127
+
128
+ begin
129
+ waiter_result = @service_client.get_rule(wait_for_resource_id).wait_until(
130
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
131
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
132
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
133
+ )
134
+ result_to_return = waiter_result
135
+
136
+ return result_to_return
137
+ rescue StandardError
138
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
139
+ end
140
+ end
141
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
142
+ # rubocop:enable Layout/EmptyLines
143
+ end
144
+ end
145
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,275 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
7
+ module OCI
8
+ # An object that represents an action to trigger for events that match a rule.
9
+ #
10
+ # This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
11
+ class Events::Models::Action
12
+ ACTION_TYPE_ENUM = [
13
+ ACTION_TYPE_ONS = 'ONS'.freeze,
14
+ ACTION_TYPE_OSS = 'OSS'.freeze,
15
+ ACTION_TYPE_FAAS = 'FAAS'.freeze,
16
+ ACTION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
17
+ ].freeze
18
+
19
+ LIFECYCLE_STATE_ENUM = [
20
+ LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
21
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
22
+ LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
23
+ LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
24
+ LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
25
+ LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
26
+ LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
27
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
28
+ ].freeze
29
+
30
+ # **[Required]** The action to perform if the condition in the rule matches an event.
31
+ #
32
+ # * **ONS:** Send to an Oracle Notification Service topic.
33
+ # * **OSS:** Send to a stream from Oracle Streaming Service.
34
+ # * **FAAS:** Send to an Oracle Functions Service endpoint.
35
+ #
36
+ # @return [String]
37
+ attr_reader :action_type
38
+
39
+ # **[Required]** The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the action.
40
+ #
41
+ # @return [String]
42
+ attr_accessor :id
43
+
44
+ # **[Required]** A message generated by the Events service about the current state of this rule.
45
+ #
46
+ # @return [String]
47
+ attr_accessor :lifecycle_message
48
+
49
+ # **[Required]** The current state of the rule.
50
+ #
51
+ # @return [String]
52
+ attr_reader :lifecycle_state
53
+
54
+ # A string that describes the details of the action. It does not have to be unique, and you can change it. Avoid entering
55
+ # confidential information.
56
+ #
57
+ # @return [String]
58
+ attr_accessor :description
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ # rubocop:disable Style/SymbolLiteral
64
+ 'action_type': :'actionType',
65
+ 'id': :'id',
66
+ 'lifecycle_message': :'lifecycleMessage',
67
+ 'lifecycle_state': :'lifecycleState',
68
+ 'description': :'description'
69
+ # rubocop:enable Style/SymbolLiteral
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.swagger_types
75
+ {
76
+ # rubocop:disable Style/SymbolLiteral
77
+ 'action_type': :'String',
78
+ 'id': :'String',
79
+ 'lifecycle_message': :'String',
80
+ 'lifecycle_state': :'String',
81
+ 'description': :'String'
82
+ # rubocop:enable Style/SymbolLiteral
83
+ }
84
+ end
85
+
86
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity, Metrics/AbcSize
87
+
88
+
89
+ # Given the hash representation of a subtype of this class,
90
+ # use the info in the hash to return the class of the subtype.
91
+ def self.get_subtype(object_hash)
92
+ type = object_hash[:'actionType'] # rubocop:disable Style/SymbolLiteral
93
+
94
+ return 'OCI::Events::Models::StreamingServiceAction' if type == 'OSS'
95
+ return 'OCI::Events::Models::NotificationServiceAction' if type == 'ONS'
96
+ return 'OCI::Events::Models::FaaSAction' if type == 'FAAS'
97
+
98
+ # TODO: Log a warning when the subtype is not found.
99
+ 'OCI::Events::Models::Action'
100
+ end
101
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity, Metrics/AbcSize
102
+
103
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
104
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
105
+
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @option attributes [String] :action_type The value to assign to the {#action_type} property
110
+ # @option attributes [String] :id The value to assign to the {#id} property
111
+ # @option attributes [String] :lifecycle_message The value to assign to the {#lifecycle_message} property
112
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
113
+ # @option attributes [String] :description The value to assign to the {#description} property
114
+ def initialize(attributes = {})
115
+ return unless attributes.is_a?(Hash)
116
+
117
+ # convert string to symbol for hash key
118
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
119
+
120
+ self.action_type = attributes[:'actionType'] if attributes[:'actionType']
121
+
122
+ raise 'You cannot provide both :actionType and :action_type' if attributes.key?(:'actionType') && attributes.key?(:'action_type')
123
+
124
+ self.action_type = attributes[:'action_type'] if attributes[:'action_type']
125
+
126
+ self.id = attributes[:'id'] if attributes[:'id']
127
+
128
+ self.lifecycle_message = attributes[:'lifecycleMessage'] if attributes[:'lifecycleMessage']
129
+
130
+ raise 'You cannot provide both :lifecycleMessage and :lifecycle_message' if attributes.key?(:'lifecycleMessage') && attributes.key?(:'lifecycle_message')
131
+
132
+ self.lifecycle_message = attributes[:'lifecycle_message'] if attributes[:'lifecycle_message']
133
+
134
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
135
+
136
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
137
+
138
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
139
+
140
+ self.description = attributes[:'description'] if attributes[:'description']
141
+ end
142
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
143
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
144
+
145
+ # Custom attribute writer method checking allowed values (enum).
146
+ # @param [Object] action_type Object to be assigned
147
+ def action_type=(action_type)
148
+ # rubocop:disable Style/ConditionalAssignment
149
+ if action_type && !ACTION_TYPE_ENUM.include?(action_type)
150
+ OCI.logger.debug("Unknown value for 'action_type' [" + action_type + "]. Mapping to 'ACTION_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
151
+ @action_type = ACTION_TYPE_UNKNOWN_ENUM_VALUE
152
+ else
153
+ @action_type = action_type
154
+ end
155
+ # rubocop:enable Style/ConditionalAssignment
156
+ end
157
+
158
+ # Custom attribute writer method checking allowed values (enum).
159
+ # @param [Object] lifecycle_state Object to be assigned
160
+ def lifecycle_state=(lifecycle_state)
161
+ # rubocop:disable Style/ConditionalAssignment
162
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
163
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
164
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
165
+ else
166
+ @lifecycle_state = lifecycle_state
167
+ end
168
+ # rubocop:enable Style/ConditionalAssignment
169
+ end
170
+
171
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
172
+
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] other the other object to be compared
176
+ def ==(other)
177
+ return true if equal?(other)
178
+
179
+ self.class == other.class &&
180
+ action_type == other.action_type &&
181
+ id == other.id &&
182
+ lifecycle_message == other.lifecycle_message &&
183
+ lifecycle_state == other.lifecycle_state &&
184
+ description == other.description
185
+ end
186
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
187
+
188
+ # @see the `==` method
189
+ # @param [Object] other the other object to be compared
190
+ def eql?(other)
191
+ self == other
192
+ end
193
+
194
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
195
+
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Fixnum] Hash code
199
+ def hash
200
+ [action_type, id, lifecycle_message, lifecycle_state, description].hash
201
+ end
202
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
203
+
204
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
205
+
206
+
207
+ # Builds the object from hash
208
+ # @param [Hash] attributes Model attributes in the form of hash
209
+ # @return [Object] Returns the model itself
210
+ def build_from_hash(attributes)
211
+ return nil unless attributes.is_a?(Hash)
212
+
213
+ self.class.swagger_types.each_pair do |key, type|
214
+ if type =~ /^Array<(.*)>/i
215
+ # check to ensure the input is an array given that the the attribute
216
+ # is documented as an array but the input is not
217
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
218
+ public_method("#{key}=").call(
219
+ attributes[self.class.attribute_map[key]]
220
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
221
+ )
222
+ end
223
+ elsif !attributes[self.class.attribute_map[key]].nil?
224
+ public_method("#{key}=").call(
225
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
226
+ )
227
+ end
228
+ # or else data not found in attributes(hash), not an issue as the data can be optional
229
+ end
230
+
231
+ self
232
+ end
233
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = public_method(attr).call
247
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ private
255
+
256
+ # Outputs non-array value in the form of hash
257
+ # For object, use to_hash. Otherwise, just return the value
258
+ # @param [Object] value Any valid value
259
+ # @return [Hash] Returns the value in the form of hash
260
+ def _to_hash(value)
261
+ if value.is_a?(Array)
262
+ value.compact.map { |v| _to_hash(v) }
263
+ elsif value.is_a?(Hash)
264
+ {}.tap do |hash|
265
+ value.each { |k, v| hash[k] = _to_hash(v) }
266
+ end
267
+ elsif value.respond_to? :to_hash
268
+ value.to_hash
269
+ else
270
+ value
271
+ end
272
+ end
273
+ end
274
+ end
275
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,222 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
6
+ module OCI
7
+ # Object used to create an action.
8
+ #
9
+ # This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
10
+ class Events::Models::ActionDetails
11
+ ACTION_TYPE_ENUM = [
12
+ ACTION_TYPE_ONS = 'ONS'.freeze,
13
+ ACTION_TYPE_OSS = 'OSS'.freeze,
14
+ ACTION_TYPE_FAAS = 'FAAS'.freeze
15
+ ].freeze
16
+
17
+ # **[Required]** The action to perform if the condition in the rule matches an event.
18
+ #
19
+ # * **ONS:** Send to an Oracle Notification Service topic.
20
+ # * **OSS:** Send to a stream from Oracle Streaming Service.
21
+ # * **FAAS:** Send to an Oracle Functions Service endpoint.
22
+ #
23
+ # @return [String]
24
+ attr_reader :action_type
25
+
26
+ # **[Required]** Whether or not this action is currently enabled.
27
+ #
28
+ # Example: `true`
29
+ #
30
+ # @return [BOOLEAN]
31
+ attr_accessor :is_enabled
32
+
33
+ # A string that describes the details of the action. It does not have to be unique, and you can change it. Avoid entering
34
+ # confidential information.
35
+ #
36
+ # @return [String]
37
+ attr_accessor :description
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ # rubocop:disable Style/SymbolLiteral
43
+ 'action_type': :'actionType',
44
+ 'is_enabled': :'isEnabled',
45
+ 'description': :'description'
46
+ # rubocop:enable Style/SymbolLiteral
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ # rubocop:disable Style/SymbolLiteral
54
+ 'action_type': :'String',
55
+ 'is_enabled': :'BOOLEAN',
56
+ 'description': :'String'
57
+ # rubocop:enable Style/SymbolLiteral
58
+ }
59
+ end
60
+
61
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity, Metrics/AbcSize
62
+
63
+
64
+ # Given the hash representation of a subtype of this class,
65
+ # use the info in the hash to return the class of the subtype.
66
+ def self.get_subtype(object_hash)
67
+ type = object_hash[:'actionType'] # rubocop:disable Style/SymbolLiteral
68
+
69
+ return 'OCI::Events::Models::CreateStreamingServiceActionDetails' if type == 'OSS'
70
+ return 'OCI::Events::Models::CreateFaaSActionDetails' if type == 'FAAS'
71
+ return 'OCI::Events::Models::CreateNotificationServiceActionDetails' if type == 'ONS'
72
+
73
+ # TODO: Log a warning when the subtype is not found.
74
+ 'OCI::Events::Models::ActionDetails'
75
+ end
76
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity, Metrics/AbcSize
77
+
78
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
79
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
80
+
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @option attributes [String] :action_type The value to assign to the {#action_type} property
85
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
86
+ # @option attributes [String] :description The value to assign to the {#description} property
87
+ def initialize(attributes = {})
88
+ return unless attributes.is_a?(Hash)
89
+
90
+ # convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
92
+
93
+ self.action_type = attributes[:'actionType'] if attributes[:'actionType']
94
+
95
+ raise 'You cannot provide both :actionType and :action_type' if attributes.key?(:'actionType') && attributes.key?(:'action_type')
96
+
97
+ self.action_type = attributes[:'action_type'] if attributes[:'action_type']
98
+
99
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
100
+ self.is_enabled = true if is_enabled.nil? && !attributes.key?(:'isEnabled') # rubocop:disable Style/StringLiterals
101
+
102
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
103
+
104
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
105
+ self.is_enabled = true if is_enabled.nil? && !attributes.key?(:'isEnabled') && !attributes.key?(:'is_enabled') # rubocop:disable Style/StringLiterals
106
+
107
+ self.description = attributes[:'description'] if attributes[:'description']
108
+ end
109
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
110
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
111
+
112
+ # Custom attribute writer method checking allowed values (enum).
113
+ # @param [Object] action_type Object to be assigned
114
+ def action_type=(action_type)
115
+ raise "Invalid value for 'action_type': this must be one of the values in ACTION_TYPE_ENUM." if action_type && !ACTION_TYPE_ENUM.include?(action_type)
116
+
117
+ @action_type = action_type
118
+ end
119
+
120
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
121
+
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] other the other object to be compared
125
+ def ==(other)
126
+ return true if equal?(other)
127
+
128
+ self.class == other.class &&
129
+ action_type == other.action_type &&
130
+ is_enabled == other.is_enabled &&
131
+ description == other.description
132
+ end
133
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
134
+
135
+ # @see the `==` method
136
+ # @param [Object] other the other object to be compared
137
+ def eql?(other)
138
+ self == other
139
+ end
140
+
141
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
142
+
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Fixnum] Hash code
146
+ def hash
147
+ [action_type, is_enabled, description].hash
148
+ end
149
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
150
+
151
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
152
+
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+
160
+ self.class.swagger_types.each_pair do |key, type|
161
+ if type =~ /^Array<(.*)>/i
162
+ # check to ensure the input is an array given that the the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ public_method("#{key}=").call(
166
+ attributes[self.class.attribute_map[key]]
167
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
168
+ )
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ public_method("#{key}=").call(
172
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
173
+ )
174
+ end
175
+ # or else data not found in attributes(hash), not an issue as the data can be optional
176
+ end
177
+
178
+ self
179
+ end
180
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = public_method(attr).call
194
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ private
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end
222
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength