oci 2.4.6 → 2.4.7

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 (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/oci.rb +2 -0
  4. data/lib/oci/database/database.rb +1 -0
  5. data/lib/oci/database/models/database.rb +18 -4
  6. data/lib/oci/database/models/database_connection_strings.rb +182 -0
  7. data/lib/oci/database/models/database_summary.rb +18 -4
  8. data/lib/oci/dns/dns.rb +23 -0
  9. data/lib/oci/dns/dns_client.rb +802 -75
  10. data/lib/oci/dns/dns_client_composite_operations.rb +238 -0
  11. data/lib/oci/dns/models/create_steering_policy_attachment_details.rb +205 -0
  12. data/lib/oci/dns/models/create_steering_policy_details.rb +333 -0
  13. data/lib/oci/dns/models/steering_policy.rb +418 -0
  14. data/lib/oci/dns/models/steering_policy_answer.rb +205 -0
  15. data/lib/oci/dns/models/steering_policy_attachment.rb +308 -0
  16. data/lib/oci/dns/models/steering_policy_attachment_summary.rb +304 -0
  17. data/lib/oci/dns/models/steering_policy_filter_answer_data.rb +168 -0
  18. data/lib/oci/dns/models/steering_policy_filter_rule.rb +178 -0
  19. data/lib/oci/dns/models/steering_policy_filter_rule_case.rb +165 -0
  20. data/lib/oci/dns/models/steering_policy_health_rule.rb +160 -0
  21. data/lib/oci/dns/models/steering_policy_health_rule_case.rb +152 -0
  22. data/lib/oci/dns/models/steering_policy_limit_rule.rb +179 -0
  23. data/lib/oci/dns/models/steering_policy_limit_rule_case.rb +162 -0
  24. data/lib/oci/dns/models/steering_policy_priority_answer_data.rb +161 -0
  25. data/lib/oci/dns/models/steering_policy_priority_rule.rb +178 -0
  26. data/lib/oci/dns/models/steering_policy_priority_rule_case.rb +165 -0
  27. data/lib/oci/dns/models/steering_policy_rule.rb +237 -0
  28. data/lib/oci/dns/models/steering_policy_summary.rb +391 -0
  29. data/lib/oci/dns/models/steering_policy_weighted_answer_data.rb +161 -0
  30. data/lib/oci/dns/models/steering_policy_weighted_rule.rb +178 -0
  31. data/lib/oci/dns/models/steering_policy_weighted_rule_case.rb +165 -0
  32. data/lib/oci/dns/models/update_steering_policy_attachment_details.rb +156 -0
  33. data/lib/oci/dns/models/update_steering_policy_details.rb +319 -0
  34. data/lib/oci/email/email.rb +1 -0
  35. data/lib/oci/email/email_client.rb +87 -16
  36. data/lib/oci/email/email_client_composite_operations.rb +40 -0
  37. data/lib/oci/email/models/create_sender_details.rb +40 -6
  38. data/lib/oci/email/models/create_suppression_details.rb +2 -2
  39. data/lib/oci/email/models/sender.rb +53 -5
  40. data/lib/oci/email/models/sender_summary.rb +38 -4
  41. data/lib/oci/email/models/suppression.rb +20 -3
  42. data/lib/oci/email/models/update_sender_details.rb +174 -0
  43. data/lib/oci/healthchecks/health_checks_client.rb +1137 -0
  44. data/lib/oci/healthchecks/health_checks_client_composite_operations.rb +24 -0
  45. data/lib/oci/healthchecks/healthchecks.rb +41 -0
  46. data/lib/oci/healthchecks/models/connection.rb +159 -0
  47. data/lib/oci/healthchecks/models/create_http_monitor_details.rb +359 -0
  48. data/lib/oci/healthchecks/models/create_on_demand_http_probe_details.rb +278 -0
  49. data/lib/oci/healthchecks/models/create_on_demand_ping_probe_details.rb +229 -0
  50. data/lib/oci/healthchecks/models/create_ping_monitor_details.rb +310 -0
  51. data/lib/oci/healthchecks/models/dns.rb +165 -0
  52. data/lib/oci/healthchecks/models/geolocation.rb +239 -0
  53. data/lib/oci/healthchecks/models/health_checks_vantage_point_summary.rb +211 -0
  54. data/lib/oci/healthchecks/models/http_monitor.rb +395 -0
  55. data/lib/oci/healthchecks/models/http_monitor_summary.rb +290 -0
  56. data/lib/oci/healthchecks/models/http_probe.rb +314 -0
  57. data/lib/oci/healthchecks/models/http_probe_method.rb +10 -0
  58. data/lib/oci/healthchecks/models/http_probe_protocol.rb +10 -0
  59. data/lib/oci/healthchecks/models/http_probe_result_summary.rb +542 -0
  60. data/lib/oci/healthchecks/models/ping_monitor.rb +340 -0
  61. data/lib/oci/healthchecks/models/ping_monitor_summary.rb +290 -0
  62. data/lib/oci/healthchecks/models/ping_probe.rb +259 -0
  63. data/lib/oci/healthchecks/models/ping_probe_protocol.rb +10 -0
  64. data/lib/oci/healthchecks/models/ping_probe_result_summary.rb +418 -0
  65. data/lib/oci/healthchecks/models/routing.rb +192 -0
  66. data/lib/oci/healthchecks/models/tcp_connection.rb +189 -0
  67. data/lib/oci/healthchecks/models/update_http_monitor_details.rb +339 -0
  68. data/lib/oci/healthchecks/models/update_ping_monitor_details.rb +292 -0
  69. data/lib/oci/healthchecks/util.rb +2 -0
  70. data/lib/oci/regions.rb +3 -1
  71. data/lib/oci/version.rb +1 -1
  72. data/lib/oci/waas/models/access_rule.rb +283 -0
  73. data/lib/oci/waas/models/access_rule_criteria.rb +206 -0
  74. data/lib/oci/waas/models/address_rate_limiting.rb +195 -0
  75. data/lib/oci/waas/models/block_challenge_settings.rb +288 -0
  76. data/lib/oci/waas/models/captcha.rb +231 -0
  77. data/lib/oci/waas/models/certificate.rb +383 -0
  78. data/lib/oci/waas/models/certificate_extensions.rb +170 -0
  79. data/lib/oci/waas/models/certificate_public_key_info.rb +170 -0
  80. data/lib/oci/waas/models/certificate_subject_name.rb +218 -0
  81. data/lib/oci/waas/models/certificate_summary.rb +274 -0
  82. data/lib/oci/waas/models/create_certificate_details.rb +241 -0
  83. data/lib/oci/waas/models/create_waas_policy_details.rb +257 -0
  84. data/lib/oci/waas/models/device_fingerprint_challenge.rb +268 -0
  85. data/lib/oci/waas/models/edge_subnet.rb +173 -0
  86. data/lib/oci/waas/models/good_bot.rb +183 -0
  87. data/lib/oci/waas/models/header.rb +159 -0
  88. data/lib/oci/waas/models/human_interaction_challenge.rb +282 -0
  89. data/lib/oci/waas/models/js_challenge.rb +240 -0
  90. data/lib/oci/waas/models/lifecycle_states.rb +14 -0
  91. data/lib/oci/waas/models/origin.rb +191 -0
  92. data/lib/oci/waas/models/policy_config.rb +181 -0
  93. data/lib/oci/waas/models/protection_rule.rb +237 -0
  94. data/lib/oci/waas/models/protection_rule_action.rb +185 -0
  95. data/lib/oci/waas/models/protection_rule_exclusion.rb +182 -0
  96. data/lib/oci/waas/models/protection_settings.rb +404 -0
  97. data/lib/oci/waas/models/recommendation.rb +210 -0
  98. data/lib/oci/waas/models/threat_feed.rb +202 -0
  99. data/lib/oci/waas/models/threat_feed_action.rb +175 -0
  100. data/lib/oci/waas/models/update_certificate_details.rb +183 -0
  101. data/lib/oci/waas/models/update_waas_policy_details.rb +233 -0
  102. data/lib/oci/waas/models/waas_policy.rb +331 -0
  103. data/lib/oci/waas/models/waas_policy_summary.rb +271 -0
  104. data/lib/oci/waas/models/waf_blocked_request.rb +219 -0
  105. data/lib/oci/waas/models/waf_config.rb +295 -0
  106. data/lib/oci/waas/models/waf_config_details.rb +253 -0
  107. data/lib/oci/waas/models/waf_log.rb +510 -0
  108. data/lib/oci/waas/models/waf_meter_datum.rb +279 -0
  109. data/lib/oci/waas/models/waf_request.rb +177 -0
  110. data/lib/oci/waas/models/waf_traffic_datum.rb +223 -0
  111. data/lib/oci/waas/models/whitelist.rb +159 -0
  112. data/lib/oci/waas/models/work_request.rb +322 -0
  113. data/lib/oci/waas/models/work_request_error.rb +170 -0
  114. data/lib/oci/waas/models/work_request_log_entry.rb +159 -0
  115. data/lib/oci/waas/models/work_request_operation_types.rb +12 -0
  116. data/lib/oci/waas/models/work_request_resource.rb +217 -0
  117. data/lib/oci/waas/models/work_request_status_values.rb +14 -0
  118. data/lib/oci/waas/models/work_request_summary.rb +302 -0
  119. data/lib/oci/waas/util.rb +2 -0
  120. data/lib/oci/waas/waas.rb +66 -0
  121. data/lib/oci/waas/waas_client.rb +3044 -0
  122. data/lib/oci/waas/waas_client_composite_operations.rb +990 -0
  123. metadata +105 -2
@@ -0,0 +1,990 @@
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::Waas::WaasClient} 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 Waas::WaasClientCompositeOperations
10
+ # The {OCI::Waas::WaasClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::Waas::WaasClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new WaasClientCompositeOperations
16
+ #
17
+ # @param [OCI::Waas::WaasClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::Waas::WaasClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::Waas::WaasClient.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::Waas::WaasClient#accept_recommendations} and then waits for the {OCI::Waas::Models::WorkRequest}
28
+ # to enter the given state(s).
29
+ #
30
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
31
+ # @param [Array<String>] protection_rule_keys
32
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
33
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#accept_recommendations}
34
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
35
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
36
+ # * max_wait_seconds The maximum time to wait, in seconds
37
+ #
38
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
39
+ def accept_recommendations_and_wait_for_state(waas_policy_id, protection_rule_keys, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
40
+ operation_result = @service_client.accept_recommendations(waas_policy_id, protection_rule_keys, base_operation_opts)
41
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
42
+
43
+ return operation_result if wait_for_states.empty? && !use_util
44
+
45
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
46
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
47
+
48
+ begin
49
+ if use_util
50
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
51
+ @service_client,
52
+ wait_for_resource_id,
53
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
54
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
55
+ )
56
+ else
57
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
58
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
59
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
60
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
61
+ )
62
+ end
63
+ result_to_return = waiter_result
64
+
65
+ return result_to_return
66
+ rescue StandardError
67
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
68
+ end
69
+ end
70
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
71
+ # rubocop:enable Layout/EmptyLines
72
+
73
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
74
+ # rubocop:disable Layout/EmptyLines
75
+
76
+
77
+ # Calls {OCI::Waas::WaasClient#create_certificate} and then waits for the {OCI::Waas::Models::Certificate} acted upon
78
+ # to enter the given state(s).
79
+ #
80
+ # @param [OCI::Waas::Models::CreateCertificateDetails] create_certificate_details The details of the SSL certificate resource to create.
81
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::Certificate#lifecycle_state}
82
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#create_certificate}
83
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
84
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
85
+ # * max_wait_seconds The maximum time to wait, in seconds
86
+ #
87
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Waas::Models::Certificate}
88
+ def create_certificate_and_wait_for_state(create_certificate_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
89
+ operation_result = @service_client.create_certificate(create_certificate_details, base_operation_opts)
90
+
91
+ return operation_result if wait_for_states.empty?
92
+
93
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
94
+ wait_for_resource_id = operation_result.data.id
95
+
96
+ begin
97
+ waiter_result = @service_client.get_certificate(wait_for_resource_id).wait_until(
98
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
99
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
100
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
101
+ )
102
+ result_to_return = waiter_result
103
+
104
+ return result_to_return
105
+ rescue StandardError
106
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
107
+ end
108
+ end
109
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
110
+ # rubocop:enable Layout/EmptyLines
111
+
112
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
113
+ # rubocop:disable Layout/EmptyLines
114
+
115
+
116
+ # Calls {OCI::Waas::WaasClient#create_waas_policy} and then waits for the {OCI::Waas::Models::WorkRequest}
117
+ # to enter the given state(s).
118
+ #
119
+ # @param [OCI::Waas::Models::CreateWaasPolicyDetails] create_waas_policy_details The details of the WAAS policy.
120
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
121
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#create_waas_policy}
122
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
123
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
124
+ # * max_wait_seconds The maximum time to wait, in seconds
125
+ #
126
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
127
+ def create_waas_policy_and_wait_for_state(create_waas_policy_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
128
+ operation_result = @service_client.create_waas_policy(create_waas_policy_details, base_operation_opts)
129
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
130
+
131
+ return operation_result if wait_for_states.empty? && !use_util
132
+
133
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
134
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
135
+
136
+ begin
137
+ if use_util
138
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
139
+ @service_client,
140
+ wait_for_resource_id,
141
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
142
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
143
+ )
144
+ else
145
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
146
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
147
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
148
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
149
+ )
150
+ end
151
+ result_to_return = waiter_result
152
+
153
+ return result_to_return
154
+ rescue StandardError
155
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
156
+ end
157
+ end
158
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
159
+ # rubocop:enable Layout/EmptyLines
160
+
161
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
162
+ # rubocop:disable Layout/EmptyLines
163
+
164
+
165
+ # Calls {OCI::Waas::WaasClient#delete_certificate} and then waits for the {OCI::Waas::Models::Certificate} acted upon
166
+ # to enter the given state(s).
167
+ #
168
+ # @param [String] certificate_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the SSL certificate used in the WAAS policy. This number is generated when the certificate is added to the policy.
169
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::Certificate#lifecycle_state}
170
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#delete_certificate}
171
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
172
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
173
+ # * max_wait_seconds The maximum time to wait, in seconds
174
+ #
175
+ # @return [OCI::Response] A {OCI::Response} object with data of type nil
176
+ def delete_certificate_and_wait_for_state(certificate_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
177
+ initial_get_result = @service_client.get_certificate(certificate_id)
178
+ operation_result = @service_client.delete_certificate(certificate_id, base_operation_opts)
179
+
180
+ return operation_result if wait_for_states.empty?
181
+
182
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
183
+
184
+ begin
185
+ waiter_result = initial_get_result.wait_until(
186
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
187
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
188
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
189
+ succeed_on_not_found: true
190
+ )
191
+ result_to_return = waiter_result
192
+
193
+ return result_to_return
194
+ rescue StandardError
195
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
196
+ end
197
+ end
198
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
199
+ # rubocop:enable Layout/EmptyLines
200
+
201
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
202
+ # rubocop:disable Layout/EmptyLines
203
+
204
+
205
+ # Calls {OCI::Waas::WaasClient#delete_waas_policy} and then waits for the {OCI::Waas::Models::WorkRequest}
206
+ # to enter the given state(s).
207
+ #
208
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
209
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
210
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#delete_waas_policy}
211
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
212
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
213
+ # * max_wait_seconds The maximum time to wait, in seconds
214
+ #
215
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
216
+ def delete_waas_policy_and_wait_for_state(waas_policy_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
217
+ operation_result = @service_client.delete_waas_policy(waas_policy_id, base_operation_opts)
218
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
219
+
220
+ return operation_result if wait_for_states.empty? && !use_util
221
+
222
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
223
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
224
+
225
+ begin
226
+ if use_util
227
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
228
+ @service_client,
229
+ wait_for_resource_id,
230
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
231
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
232
+ )
233
+ else
234
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
235
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
236
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
237
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
238
+ )
239
+ end
240
+ result_to_return = waiter_result
241
+
242
+ return result_to_return
243
+ rescue StandardError
244
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
245
+ end
246
+ end
247
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
248
+ # rubocop:enable Layout/EmptyLines
249
+
250
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
251
+ # rubocop:disable Layout/EmptyLines
252
+
253
+
254
+ # Calls {OCI::Waas::WaasClient#update_access_rules} and then waits for the {OCI::Waas::Models::WorkRequest}
255
+ # to enter the given state(s).
256
+ #
257
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
258
+ # @param [Array<OCI::Waas::Models::OCI::Waas::Models::AccessRule>] access_rules
259
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
260
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_access_rules}
261
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
262
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
263
+ # * max_wait_seconds The maximum time to wait, in seconds
264
+ #
265
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
266
+ def update_access_rules_and_wait_for_state(waas_policy_id, access_rules, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
267
+ operation_result = @service_client.update_access_rules(waas_policy_id, access_rules, base_operation_opts)
268
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
269
+
270
+ return operation_result if wait_for_states.empty? && !use_util
271
+
272
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
273
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
274
+
275
+ begin
276
+ if use_util
277
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
278
+ @service_client,
279
+ wait_for_resource_id,
280
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
281
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
282
+ )
283
+ else
284
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
285
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
286
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
287
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
288
+ )
289
+ end
290
+ result_to_return = waiter_result
291
+
292
+ return result_to_return
293
+ rescue StandardError
294
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
295
+ end
296
+ end
297
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
298
+ # rubocop:enable Layout/EmptyLines
299
+
300
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
301
+ # rubocop:disable Layout/EmptyLines
302
+
303
+
304
+ # Calls {OCI::Waas::WaasClient#update_captchas} and then waits for the {OCI::Waas::Models::WorkRequest}
305
+ # to enter the given state(s).
306
+ #
307
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
308
+ # @param [Array<OCI::Waas::Models::OCI::Waas::Models::Captcha>] captchas A list of CAPTCHA details.
309
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
310
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_captchas}
311
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
312
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
313
+ # * max_wait_seconds The maximum time to wait, in seconds
314
+ #
315
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
316
+ def update_captchas_and_wait_for_state(waas_policy_id, captchas, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
317
+ operation_result = @service_client.update_captchas(waas_policy_id, captchas, base_operation_opts)
318
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
319
+
320
+ return operation_result if wait_for_states.empty? && !use_util
321
+
322
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
323
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
324
+
325
+ begin
326
+ if use_util
327
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
328
+ @service_client,
329
+ wait_for_resource_id,
330
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
331
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
332
+ )
333
+ else
334
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
335
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
336
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
337
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
338
+ )
339
+ end
340
+ result_to_return = waiter_result
341
+
342
+ return result_to_return
343
+ rescue StandardError
344
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
345
+ end
346
+ end
347
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
348
+ # rubocop:enable Layout/EmptyLines
349
+
350
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
351
+ # rubocop:disable Layout/EmptyLines
352
+
353
+
354
+ # Calls {OCI::Waas::WaasClient#update_certificate} and then waits for the {OCI::Waas::Models::Certificate} acted upon
355
+ # to enter the given state(s).
356
+ #
357
+ # @param [String] certificate_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the SSL certificate used in the WAAS policy. This number is generated when the certificate is added to the policy.
358
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::Certificate#lifecycle_state}
359
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_certificate}
360
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
361
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
362
+ # * max_wait_seconds The maximum time to wait, in seconds
363
+ #
364
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Waas::Models::Certificate}
365
+ def update_certificate_and_wait_for_state(certificate_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
366
+ operation_result = @service_client.update_certificate(certificate_id, base_operation_opts)
367
+
368
+ return operation_result if wait_for_states.empty?
369
+
370
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
371
+ wait_for_resource_id = operation_result.data.id
372
+
373
+ begin
374
+ waiter_result = @service_client.get_certificate(wait_for_resource_id).wait_until(
375
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
376
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
377
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
378
+ )
379
+ result_to_return = waiter_result
380
+
381
+ return result_to_return
382
+ rescue StandardError
383
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
384
+ end
385
+ end
386
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
387
+ # rubocop:enable Layout/EmptyLines
388
+
389
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
390
+ # rubocop:disable Layout/EmptyLines
391
+
392
+
393
+ # Calls {OCI::Waas::WaasClient#update_device_fingerprint_challenge} and then waits for the {OCI::Waas::Models::WorkRequest}
394
+ # to enter the given state(s).
395
+ #
396
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
397
+ # @param [OCI::Waas::Models::DeviceFingerprintChallenge] update_device_fingerprint_challenge_details The device fingerprint challenge settings to be updated.
398
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
399
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_device_fingerprint_challenge}
400
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
401
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
402
+ # * max_wait_seconds The maximum time to wait, in seconds
403
+ #
404
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
405
+ def update_device_fingerprint_challenge_and_wait_for_state(waas_policy_id, update_device_fingerprint_challenge_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
406
+ operation_result = @service_client.update_device_fingerprint_challenge(waas_policy_id, update_device_fingerprint_challenge_details, base_operation_opts)
407
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
408
+
409
+ return operation_result if wait_for_states.empty? && !use_util
410
+
411
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
412
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
413
+
414
+ begin
415
+ if use_util
416
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
417
+ @service_client,
418
+ wait_for_resource_id,
419
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
420
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
421
+ )
422
+ else
423
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
424
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
425
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
426
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
427
+ )
428
+ end
429
+ result_to_return = waiter_result
430
+
431
+ return result_to_return
432
+ rescue StandardError
433
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
434
+ end
435
+ end
436
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
437
+ # rubocop:enable Layout/EmptyLines
438
+
439
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
440
+ # rubocop:disable Layout/EmptyLines
441
+
442
+
443
+ # Calls {OCI::Waas::WaasClient#update_good_bots} and then waits for the {OCI::Waas::Models::WorkRequest}
444
+ # to enter the given state(s).
445
+ #
446
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
447
+ # @param [Array<OCI::Waas::Models::OCI::Waas::Models::GoodBot>] good_bots
448
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
449
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_good_bots}
450
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
451
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
452
+ # * max_wait_seconds The maximum time to wait, in seconds
453
+ #
454
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
455
+ def update_good_bots_and_wait_for_state(waas_policy_id, good_bots, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
456
+ operation_result = @service_client.update_good_bots(waas_policy_id, good_bots, base_operation_opts)
457
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
458
+
459
+ return operation_result if wait_for_states.empty? && !use_util
460
+
461
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
462
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
463
+
464
+ begin
465
+ if use_util
466
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
467
+ @service_client,
468
+ wait_for_resource_id,
469
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
470
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
471
+ )
472
+ else
473
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
474
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
475
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
476
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
477
+ )
478
+ end
479
+ result_to_return = waiter_result
480
+
481
+ return result_to_return
482
+ rescue StandardError
483
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
484
+ end
485
+ end
486
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
487
+ # rubocop:enable Layout/EmptyLines
488
+
489
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
490
+ # rubocop:disable Layout/EmptyLines
491
+
492
+
493
+ # Calls {OCI::Waas::WaasClient#update_human_interaction_challenge} and then waits for the {OCI::Waas::Models::WorkRequest}
494
+ # to enter the given state(s).
495
+ #
496
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
497
+ # @param [OCI::Waas::Models::HumanInteractionChallenge] update_human_interaction_challenge_details The human interaction challenge settings.
498
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
499
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_human_interaction_challenge}
500
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
501
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
502
+ # * max_wait_seconds The maximum time to wait, in seconds
503
+ #
504
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
505
+ def update_human_interaction_challenge_and_wait_for_state(waas_policy_id, update_human_interaction_challenge_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
506
+ operation_result = @service_client.update_human_interaction_challenge(waas_policy_id, update_human_interaction_challenge_details, base_operation_opts)
507
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
508
+
509
+ return operation_result if wait_for_states.empty? && !use_util
510
+
511
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
512
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
513
+
514
+ begin
515
+ if use_util
516
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
517
+ @service_client,
518
+ wait_for_resource_id,
519
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
520
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
521
+ )
522
+ else
523
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
524
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
525
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
526
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
527
+ )
528
+ end
529
+ result_to_return = waiter_result
530
+
531
+ return result_to_return
532
+ rescue StandardError
533
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
534
+ end
535
+ end
536
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
537
+ # rubocop:enable Layout/EmptyLines
538
+
539
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
540
+ # rubocop:disable Layout/EmptyLines
541
+
542
+
543
+ # Calls {OCI::Waas::WaasClient#update_js_challenge} and then waits for the {OCI::Waas::Models::WorkRequest}
544
+ # to enter the given state(s).
545
+ #
546
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
547
+ # @param [OCI::Waas::Models::JsChallenge] update_js_challenge_details The JavaScript challenge settings to be updated.
548
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
549
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_js_challenge}
550
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
551
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
552
+ # * max_wait_seconds The maximum time to wait, in seconds
553
+ #
554
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
555
+ def update_js_challenge_and_wait_for_state(waas_policy_id, update_js_challenge_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
556
+ operation_result = @service_client.update_js_challenge(waas_policy_id, update_js_challenge_details, base_operation_opts)
557
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
558
+
559
+ return operation_result if wait_for_states.empty? && !use_util
560
+
561
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
562
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
563
+
564
+ begin
565
+ if use_util
566
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
567
+ @service_client,
568
+ wait_for_resource_id,
569
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
570
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
571
+ )
572
+ else
573
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
574
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
575
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
576
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
577
+ )
578
+ end
579
+ result_to_return = waiter_result
580
+
581
+ return result_to_return
582
+ rescue StandardError
583
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
584
+ end
585
+ end
586
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
587
+ # rubocop:enable Layout/EmptyLines
588
+
589
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
590
+ # rubocop:disable Layout/EmptyLines
591
+
592
+
593
+ # Calls {OCI::Waas::WaasClient#update_policy_config} and then waits for the {OCI::Waas::Models::WorkRequest}
594
+ # to enter the given state(s).
595
+ #
596
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
597
+ # @param [OCI::Waas::Models::PolicyConfig] update_policy_config_details The new configuration to apply to a WAAS policy.
598
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
599
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_policy_config}
600
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
601
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
602
+ # * max_wait_seconds The maximum time to wait, in seconds
603
+ #
604
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
605
+ def update_policy_config_and_wait_for_state(waas_policy_id, update_policy_config_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
606
+ operation_result = @service_client.update_policy_config(waas_policy_id, update_policy_config_details, base_operation_opts)
607
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
608
+
609
+ return operation_result if wait_for_states.empty? && !use_util
610
+
611
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
612
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
613
+
614
+ begin
615
+ if use_util
616
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
617
+ @service_client,
618
+ wait_for_resource_id,
619
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
620
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
621
+ )
622
+ else
623
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
624
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
625
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
626
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
627
+ )
628
+ end
629
+ result_to_return = waiter_result
630
+
631
+ return result_to_return
632
+ rescue StandardError
633
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
634
+ end
635
+ end
636
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
637
+ # rubocop:enable Layout/EmptyLines
638
+
639
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
640
+ # rubocop:disable Layout/EmptyLines
641
+
642
+
643
+ # Calls {OCI::Waas::WaasClient#update_protection_rules} and then waits for the {OCI::Waas::Models::WorkRequest}
644
+ # to enter the given state(s).
645
+ #
646
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
647
+ # @param [Array<OCI::Waas::Models::OCI::Waas::Models::ProtectionRuleAction>] protection_rules
648
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
649
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_protection_rules}
650
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
651
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
652
+ # * max_wait_seconds The maximum time to wait, in seconds
653
+ #
654
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
655
+ def update_protection_rules_and_wait_for_state(waas_policy_id, protection_rules, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
656
+ operation_result = @service_client.update_protection_rules(waas_policy_id, protection_rules, base_operation_opts)
657
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
658
+
659
+ return operation_result if wait_for_states.empty? && !use_util
660
+
661
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
662
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
663
+
664
+ begin
665
+ if use_util
666
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
667
+ @service_client,
668
+ wait_for_resource_id,
669
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
670
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
671
+ )
672
+ else
673
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
674
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
675
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
676
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
677
+ )
678
+ end
679
+ result_to_return = waiter_result
680
+
681
+ return result_to_return
682
+ rescue StandardError
683
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
684
+ end
685
+ end
686
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
687
+ # rubocop:enable Layout/EmptyLines
688
+
689
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
690
+ # rubocop:disable Layout/EmptyLines
691
+
692
+
693
+ # Calls {OCI::Waas::WaasClient#update_protection_settings} and then waits for the {OCI::Waas::Models::WorkRequest}
694
+ # to enter the given state(s).
695
+ #
696
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
697
+ # @param [OCI::Waas::Models::ProtectionSettings] update_protection_settings_details The details of the protection settings to be updated.
698
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
699
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_protection_settings}
700
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
701
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
702
+ # * max_wait_seconds The maximum time to wait, in seconds
703
+ #
704
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
705
+ def update_protection_settings_and_wait_for_state(waas_policy_id, update_protection_settings_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
706
+ operation_result = @service_client.update_protection_settings(waas_policy_id, update_protection_settings_details, base_operation_opts)
707
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
708
+
709
+ return operation_result if wait_for_states.empty? && !use_util
710
+
711
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
712
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
713
+
714
+ begin
715
+ if use_util
716
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
717
+ @service_client,
718
+ wait_for_resource_id,
719
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
720
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
721
+ )
722
+ else
723
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
724
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
725
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
726
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
727
+ )
728
+ end
729
+ result_to_return = waiter_result
730
+
731
+ return result_to_return
732
+ rescue StandardError
733
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
734
+ end
735
+ end
736
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
737
+ # rubocop:enable Layout/EmptyLines
738
+
739
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
740
+ # rubocop:disable Layout/EmptyLines
741
+
742
+
743
+ # Calls {OCI::Waas::WaasClient#update_threat_feeds} and then waits for the {OCI::Waas::Models::WorkRequest}
744
+ # to enter the given state(s).
745
+ #
746
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
747
+ # @param [Array<OCI::Waas::Models::OCI::Waas::Models::ThreatFeedAction>] threat_feeds A list of threat feeds for which to update the actions.
748
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
749
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_threat_feeds}
750
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
751
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
752
+ # * max_wait_seconds The maximum time to wait, in seconds
753
+ #
754
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
755
+ def update_threat_feeds_and_wait_for_state(waas_policy_id, threat_feeds, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
756
+ operation_result = @service_client.update_threat_feeds(waas_policy_id, threat_feeds, base_operation_opts)
757
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
758
+
759
+ return operation_result if wait_for_states.empty? && !use_util
760
+
761
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
762
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
763
+
764
+ begin
765
+ if use_util
766
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
767
+ @service_client,
768
+ wait_for_resource_id,
769
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
770
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
771
+ )
772
+ else
773
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
774
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
775
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
776
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
777
+ )
778
+ end
779
+ result_to_return = waiter_result
780
+
781
+ return result_to_return
782
+ rescue StandardError
783
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
784
+ end
785
+ end
786
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
787
+ # rubocop:enable Layout/EmptyLines
788
+
789
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
790
+ # rubocop:disable Layout/EmptyLines
791
+
792
+
793
+ # Calls {OCI::Waas::WaasClient#update_waas_policy} and then waits for the {OCI::Waas::Models::WorkRequest}
794
+ # to enter the given state(s).
795
+ #
796
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
797
+ # @param [OCI::Waas::Models::UpdateWaasPolicyDetails] update_waas_policy_details The details of the WAAS policy to update.
798
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
799
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_waas_policy}
800
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
801
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
802
+ # * max_wait_seconds The maximum time to wait, in seconds
803
+ #
804
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
805
+ def update_waas_policy_and_wait_for_state(waas_policy_id, update_waas_policy_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
806
+ operation_result = @service_client.update_waas_policy(waas_policy_id, update_waas_policy_details, base_operation_opts)
807
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
808
+
809
+ return operation_result if wait_for_states.empty? && !use_util
810
+
811
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
812
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
813
+
814
+ begin
815
+ if use_util
816
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
817
+ @service_client,
818
+ wait_for_resource_id,
819
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
820
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
821
+ )
822
+ else
823
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
824
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
825
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
826
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
827
+ )
828
+ end
829
+ result_to_return = waiter_result
830
+
831
+ return result_to_return
832
+ rescue StandardError
833
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
834
+ end
835
+ end
836
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
837
+ # rubocop:enable Layout/EmptyLines
838
+
839
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
840
+ # rubocop:disable Layout/EmptyLines
841
+
842
+
843
+ # Calls {OCI::Waas::WaasClient#update_waf_address_rate_limiting} and then waits for the {OCI::Waas::Models::WorkRequest}
844
+ # to enter the given state(s).
845
+ #
846
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
847
+ # @param [OCI::Waas::Models::AddressRateLimiting] update_waf_address_rate_limiting_details The address rate limiting settings.
848
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
849
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_waf_address_rate_limiting}
850
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
851
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
852
+ # * max_wait_seconds The maximum time to wait, in seconds
853
+ #
854
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
855
+ def update_waf_address_rate_limiting_and_wait_for_state(waas_policy_id, update_waf_address_rate_limiting_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
856
+ operation_result = @service_client.update_waf_address_rate_limiting(waas_policy_id, update_waf_address_rate_limiting_details, base_operation_opts)
857
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
858
+
859
+ return operation_result if wait_for_states.empty? && !use_util
860
+
861
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
862
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
863
+
864
+ begin
865
+ if use_util
866
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
867
+ @service_client,
868
+ wait_for_resource_id,
869
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
870
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
871
+ )
872
+ else
873
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
874
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
875
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
876
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
877
+ )
878
+ end
879
+ result_to_return = waiter_result
880
+
881
+ return result_to_return
882
+ rescue StandardError
883
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
884
+ end
885
+ end
886
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
887
+ # rubocop:enable Layout/EmptyLines
888
+
889
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
890
+ # rubocop:disable Layout/EmptyLines
891
+
892
+
893
+ # Calls {OCI::Waas::WaasClient#update_waf_config} and then waits for the {OCI::Waas::Models::WorkRequest}
894
+ # to enter the given state(s).
895
+ #
896
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
897
+ # @param [OCI::Waas::Models::WafConfig] update_waf_config_details The new Web Application Firewall configuration to apply to a WAAS policy.
898
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
899
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_waf_config}
900
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
901
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
902
+ # * max_wait_seconds The maximum time to wait, in seconds
903
+ #
904
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
905
+ def update_waf_config_and_wait_for_state(waas_policy_id, update_waf_config_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
906
+ operation_result = @service_client.update_waf_config(waas_policy_id, update_waf_config_details, base_operation_opts)
907
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
908
+
909
+ return operation_result if wait_for_states.empty? && !use_util
910
+
911
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
912
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
913
+
914
+ begin
915
+ if use_util
916
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
917
+ @service_client,
918
+ wait_for_resource_id,
919
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
920
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
921
+ )
922
+ else
923
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
924
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
925
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
926
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
927
+ )
928
+ end
929
+ result_to_return = waiter_result
930
+
931
+ return result_to_return
932
+ rescue StandardError
933
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
934
+ end
935
+ end
936
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
937
+ # rubocop:enable Layout/EmptyLines
938
+
939
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
940
+ # rubocop:disable Layout/EmptyLines
941
+
942
+
943
+ # Calls {OCI::Waas::WaasClient#update_whitelists} and then waits for the {OCI::Waas::Models::WorkRequest}
944
+ # to enter the given state(s).
945
+ #
946
+ # @param [String] waas_policy_id The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the WAAS policy.
947
+ # @param [Array<OCI::Waas::Models::OCI::Waas::Models::Whitelist>] whitelists
948
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Waas::Models::WorkRequest#status}
949
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Waas::WaasClient#update_whitelists}
950
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
951
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
952
+ # * max_wait_seconds The maximum time to wait, in seconds
953
+ #
954
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::Waas::Models::WorkRequest}
955
+ def update_whitelists_and_wait_for_state(waas_policy_id, whitelists, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
956
+ operation_result = @service_client.update_whitelists(waas_policy_id, whitelists, base_operation_opts)
957
+ use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)
958
+
959
+ return operation_result if wait_for_states.empty? && !use_util
960
+
961
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
962
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
963
+
964
+ begin
965
+ if use_util
966
+ waiter_result = OCI::Waas::Util.wait_on_work_request(
967
+ @service_client,
968
+ wait_for_resource_id,
969
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
970
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
971
+ )
972
+ else
973
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
974
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
975
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
976
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
977
+ )
978
+ end
979
+ result_to_return = waiter_result
980
+
981
+ return result_to_return
982
+ rescue StandardError
983
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
984
+ end
985
+ end
986
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
987
+ # rubocop:enable Layout/EmptyLines
988
+ end
989
+ end
990
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength