Class: OCI::Waas::WaasClientCompositeOperations

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/waas/waas_client_composite_operations.rb

Overview

This class provides a wrapper around WaasClient and offers convenience methods for operations that would otherwise need to be chained together. For example, instead of performing an action on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource to enter a given state, you can call a single method in this class to accomplish the same functionality

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_client = OCI::Waas::WaasClient.new) ⇒ WaasClientCompositeOperations

Initializes a new WaasClientCompositeOperations

Parameters:



19
20
21
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 19

def initialize(service_client = OCI::Waas::WaasClient.new)
  @service_client = service_client
end

Instance Attribute Details

#service_clientOCI::Waas::WaasClient (readonly)

The OCI::Waas::WaasClient used to communicate with the service_client



13
14
15
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 13

def service_client
  @service_client
end

Instance Method Details

#accept_recommendations_and_wait_for_state(waas_policy_id, protection_rule_keys, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#accept_recommendations and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • protection_rule_keys (Array<String>)
  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#accept_recommendations

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 39

def accept_recommendations_and_wait_for_state(waas_policy_id, protection_rule_keys, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.accept_recommendations(waas_policy_id, protection_rule_keys, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#create_certificate_and_wait_for_state(create_certificate_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#create_certificate and then waits for the Models::Certificate acted upon to enter the given state(s).

Parameters:

  • create_certificate_details (OCI::Waas::Models::CreateCertificateDetails)

    The details of the SSL certificate resource to create.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Certificate#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#create_certificate

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 88

def create_certificate_and_wait_for_state(create_certificate_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_certificate(create_certificate_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_certificate(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#create_waas_policy_and_wait_for_state(create_waas_policy_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#create_waas_policy and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • create_waas_policy_details (OCI::Waas::Models::CreateWaasPolicyDetails)

    The details of the WAAS policy.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#create_waas_policy

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 127

def create_waas_policy_and_wait_for_state(create_waas_policy_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_waas_policy(create_waas_policy_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#delete_certificate_and_wait_for_state(certificate_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#delete_certificate and then waits for the Models::Certificate acted upon to enter the given state(s).

Parameters:

  • certificate_id (String)

    The [OCID](docs.cloud.oracle.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.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Certificate#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#delete_certificate

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 176

def delete_certificate_and_wait_for_state(certificate_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_certificate(certificate_id)
  operation_result = @service_client.delete_certificate(certificate_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#delete_waas_policy_and_wait_for_state(waas_policy_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#delete_waas_policy and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#delete_waas_policy

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 216

def delete_waas_policy_and_wait_for_state(waas_policy_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.delete_waas_policy(waas_policy_id, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_access_rules_and_wait_for_state(waas_policy_id, access_rules, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_access_rules and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • access_rules (Array<OCI::Waas::Models::OCI::Waas::Models::AccessRule>)
  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_access_rules

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 266

def update_access_rules_and_wait_for_state(waas_policy_id, access_rules, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_access_rules(waas_policy_id, access_rules, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_captchas_and_wait_for_state(waas_policy_id, captchas, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_captchas and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • captchas (Array<OCI::Waas::Models::OCI::Waas::Models::Captcha>)

    A list of CAPTCHA details.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_captchas

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 316

def update_captchas_and_wait_for_state(waas_policy_id, captchas, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_captchas(waas_policy_id, captchas, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_certificate_and_wait_for_state(certificate_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_certificate and then waits for the Models::Certificate acted upon to enter the given state(s).

Parameters:

  • certificate_id (String)

    The [OCID](docs.cloud.oracle.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.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Certificate#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_certificate

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 365

def update_certificate_and_wait_for_state(certificate_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_certificate(certificate_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_certificate(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_device_fingerprint_challenge_and_wait_for_state(waas_policy_id, update_device_fingerprint_challenge_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_device_fingerprint_challenge and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 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 = {})
  operation_result = @service_client.update_device_fingerprint_challenge(waas_policy_id, update_device_fingerprint_challenge_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_good_bots_and_wait_for_state(waas_policy_id, good_bots, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_good_bots and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • good_bots (Array<OCI::Waas::Models::OCI::Waas::Models::GoodBot>)
  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_good_bots

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 455

def update_good_bots_and_wait_for_state(waas_policy_id, good_bots, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_good_bots(waas_policy_id, good_bots, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_human_interaction_challenge_and_wait_for_state(waas_policy_id, update_human_interaction_challenge_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_human_interaction_challenge and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 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 = {})
  operation_result = @service_client.update_human_interaction_challenge(waas_policy_id, update_human_interaction_challenge_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_js_challenge_and_wait_for_state(waas_policy_id, update_js_challenge_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_js_challenge and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 555

def update_js_challenge_and_wait_for_state(waas_policy_id, update_js_challenge_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_js_challenge(waas_policy_id, update_js_challenge_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_policy_config_and_wait_for_state(waas_policy_id, update_policy_config_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_policy_config and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 605

def update_policy_config_and_wait_for_state(waas_policy_id, update_policy_config_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_policy_config(waas_policy_id, update_policy_config_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_protection_rules_and_wait_for_state(waas_policy_id, protection_rules, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_protection_rules and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • protection_rules (Array<OCI::Waas::Models::OCI::Waas::Models::ProtectionRuleAction>)
  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_protection_rules

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 655

def update_protection_rules_and_wait_for_state(waas_policy_id, protection_rules, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_protection_rules(waas_policy_id, protection_rules, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_protection_settings_and_wait_for_state(waas_policy_id, update_protection_settings_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_protection_settings and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 705

def update_protection_settings_and_wait_for_state(waas_policy_id, update_protection_settings_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_protection_settings(waas_policy_id, update_protection_settings_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_threat_feeds_and_wait_for_state(waas_policy_id, threat_feeds, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_threat_feeds and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • threat_feeds (Array<OCI::Waas::Models::OCI::Waas::Models::ThreatFeedAction>)

    A list of threat feeds for which to update the actions.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_threat_feeds

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 755

def update_threat_feeds_and_wait_for_state(waas_policy_id, threat_feeds, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_threat_feeds(waas_policy_id, threat_feeds, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_waas_policy_and_wait_for_state(waas_policy_id, update_waas_policy_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_waas_policy and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 805

def update_waas_policy_and_wait_for_state(waas_policy_id, update_waas_policy_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_waas_policy(waas_policy_id, update_waas_policy_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#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 = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_waf_address_rate_limiting and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 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 = {})
  operation_result = @service_client.update_waf_address_rate_limiting(waas_policy_id, update_waf_address_rate_limiting_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_waf_config_and_wait_for_state(waas_policy_id, update_waf_config_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_waf_config and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • update_waf_config_details (OCI::Waas::Models::WafConfig)

    The new Web Application Firewall configuration to apply to a WAAS policy.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_waf_config

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 905

def update_waf_config_and_wait_for_state(waas_policy_id, update_waf_config_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_waf_config(waas_policy_id, update_waf_config_details, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_whitelists_and_wait_for_state(waas_policy_id, whitelists, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Waas::WaasClient#update_whitelists and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • waas_policy_id (String)
  • whitelists (Array<OCI::Waas::Models::OCI::Waas::Models::Whitelist>)
  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::WorkRequest#status

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Waas::WaasClient#update_whitelists

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
# File 'lib/oci/waas/waas_client_composite_operations.rb', line 955

def update_whitelists_and_wait_for_state(waas_policy_id, whitelists, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_whitelists(waas_policy_id, whitelists, base_operation_opts)
  use_util = OCI::Waas::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']

  begin
    if use_util
      waiter_result = OCI::Waas::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
        max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
        max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
      )
    end
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end