File: //lib/python3.9/site-packages/oci/cloud_guard/cloud_guard_client_composite_operations.py
# coding: utf-8
# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20200131
import oci # noqa: F401
from oci.util import WAIT_RESOURCE_NOT_FOUND # noqa: F401
class CloudGuardClientCompositeOperations(object):
"""
This class provides a wrapper around :py:class:`~oci.cloud_guard.CloudGuardClient` 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
"""
def __init__(self, client, **kwargs):
"""
Creates a new CloudGuardClientCompositeOperations object
:param CloudGuardClient client:
The service client which will be wrapped by this object
"""
self.client = client
def add_compartment_and_wait_for_state(self, security_zone_id, add_compartment_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.add_compartment` and waits for the :py:class:`~oci.cloud_guard.models.SecurityZone` acted upon
to enter the given state(s).
:param str security_zone_id: (required)
The unique identifier of the security zone (`SecurityZone` resource).
:param oci.cloud_guard.models.AddCompartmentDetails add_compartment_details: (required)
Parameters for an existing compartment to be added to a security zone
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityZone.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.add_compartment`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.add_compartment(security_zone_id, add_compartment_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
security_zone_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_security_zone(security_zone_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def change_data_source_compartment_and_wait_for_state(self, data_source_id, change_data_source_compartment_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.change_data_source_compartment` and waits for the :py:class:`~oci.cloud_guard.models.WorkRequest`
to enter the given state(s).
:param str data_source_id: (required)
Data source OCID.
:param oci.cloud_guard.models.ChangeDataSourceCompartmentDetails change_data_source_compartment_details: (required)
The compartment OCID of the DataSource resource
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.change_data_source_compartment`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.change_data_source_compartment(data_source_id, change_data_source_compartment_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
if 'opc-work-request-id' not in operation_result.headers:
return operation_result
wait_for_resource_id = operation_result.headers['opc-work-request-id']
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_work_request(wait_for_resource_id),
evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_adhoc_query_and_wait_for_state(self, create_adhoc_query_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_adhoc_query` and waits for the :py:class:`~oci.cloud_guard.models.AdhocQuery` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateAdhocQueryDetails create_adhoc_query_details: (required)
Details for the new AdhocQuery resource
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.AdhocQuery.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_adhoc_query`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_adhoc_query(create_adhoc_query_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
adhoc_query_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_adhoc_query(adhoc_query_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_data_mask_rule_and_wait_for_state(self, create_data_mask_rule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_data_mask_rule` and waits for the :py:class:`~oci.cloud_guard.models.DataMaskRule` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateDataMaskRuleDetails create_data_mask_rule_details: (required)
Definition for the new data mask rule
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DataMaskRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_data_mask_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_data_mask_rule(create_data_mask_rule_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
data_mask_rule_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_data_mask_rule(data_mask_rule_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_data_source_and_wait_for_state(self, create_data_source_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_data_source` and waits for the :py:class:`~oci.cloud_guard.models.WorkRequest`
to enter the given state(s).
:param oci.cloud_guard.models.CreateDataSourceDetails create_data_source_details: (required)
Details for the new DataSource resource
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_data_source`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_data_source(create_data_source_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
if 'opc-work-request-id' not in operation_result.headers:
return operation_result
wait_for_resource_id = operation_result.headers['opc-work-request-id']
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_work_request(wait_for_resource_id),
evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_detector_recipe_and_wait_for_state(self, create_detector_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_detector_recipe` and waits for the :py:class:`~oci.cloud_guard.models.DetectorRecipe` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateDetectorRecipeDetails create_detector_recipe_details: (required)
Details for the new DetectorRecipe
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DetectorRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_detector_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_detector_recipe(create_detector_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
detector_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_detector_recipe(detector_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_detector_recipe_detector_rule_and_wait_for_state(self, detector_recipe_id, create_detector_recipe_detector_rule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_detector_recipe_detector_rule` and waits for the :py:class:`~oci.cloud_guard.models.DetectorRecipeDetectorRule` acted upon
to enter the given state(s).
:param str detector_recipe_id: (required)
Detector recipe OCID
:param oci.cloud_guard.models.CreateDetectorRecipeDetectorRuleDetails create_detector_recipe_detector_rule_details: (required)
The details with which detector rule is to be created.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DetectorRecipeDetectorRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_detector_recipe_detector_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_detector_recipe_detector_rule(detector_recipe_id, create_detector_recipe_detector_rule_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
detector_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_detector_recipe_detector_rule(detector_recipe_id, detector_rule_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_managed_list_and_wait_for_state(self, create_managed_list_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_managed_list` and waits for the :py:class:`~oci.cloud_guard.models.ManagedList` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateManagedListDetails create_managed_list_details: (required)
Details for the new ManagedList resources
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.ManagedList.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_managed_list`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_managed_list(create_managed_list_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
managed_list_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_managed_list(managed_list_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_responder_recipe_and_wait_for_state(self, create_responder_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_responder_recipe` and waits for the :py:class:`~oci.cloud_guard.models.ResponderRecipe` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateResponderRecipeDetails create_responder_recipe_details: (required)
Details for ResponderRecipe
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.ResponderRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_responder_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_responder_recipe(create_responder_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
responder_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_responder_recipe(responder_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_saved_query_and_wait_for_state(self, create_saved_query_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_saved_query` and waits for the :py:class:`~oci.cloud_guard.models.SavedQuery` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateSavedQueryDetails create_saved_query_details: (required)
Details for the new SavedQuery resource
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SavedQuery.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_saved_query`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_saved_query(create_saved_query_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
saved_query_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_saved_query(saved_query_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_security_recipe_and_wait_for_state(self, create_security_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_security_recipe` and waits for the :py:class:`~oci.cloud_guard.models.SecurityRecipe` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateSecurityRecipeDetails create_security_recipe_details: (required)
Details for the new `SecurityRecipe` resource
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_security_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_security_recipe(create_security_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
security_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_security_recipe(security_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_security_zone_and_wait_for_state(self, create_security_zone_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_security_zone` and waits for the :py:class:`~oci.cloud_guard.models.SecurityZone` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateSecurityZoneDetails create_security_zone_details: (required)
Details for the new `SecurityZone` resource
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityZone.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_security_zone`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_security_zone(create_security_zone_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
security_zone_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_security_zone(security_zone_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_target_and_wait_for_state(self, create_target_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_target` and waits for the :py:class:`~oci.cloud_guard.models.Target` acted upon
to enter the given state(s).
:param oci.cloud_guard.models.CreateTargetDetails create_target_details: (required)
Contains generic target information which is required for all target types
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.Target.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_target`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_target(create_target_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
target_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_target(target_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def create_target_detector_recipe_and_wait_for_state(self, target_id, attach_target_detector_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.create_target_detector_recipe` and waits for the :py:class:`~oci.cloud_guard.models.TargetDetectorRecipe` acted upon
to enter the given state(s).
:param str target_id: (required)
OCID of the target
:param oci.cloud_guard.models.AttachTargetDetectorRecipeDetails attach_target_detector_recipe_details: (required)
Details for associating DetectorRecipe with Target
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.TargetDetectorRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.create_target_detector_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.create_target_detector_recipe(target_id, attach_target_detector_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
target_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_target_detector_recipe(target_id, target_detector_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_adhoc_query_and_wait_for_state(self, adhoc_query_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_adhoc_query` and waits for the :py:class:`~oci.cloud_guard.models.AdhocQuery` acted upon
to enter the given state(s).
:param str adhoc_query_id: (required)
Adhoc query OCID.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.AdhocQuery.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_adhoc_query`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_adhoc_query(adhoc_query_id)
operation_result = None
try:
operation_result = self.client.delete_adhoc_query(adhoc_query_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_adhoc_query, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_data_mask_rule_and_wait_for_state(self, data_mask_rule_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_data_mask_rule` and waits for the :py:class:`~oci.cloud_guard.models.DataMaskRule` acted upon
to enter the given state(s).
:param str data_mask_rule_id: (required)
OCID of the data mask rule
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DataMaskRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_data_mask_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_data_mask_rule(data_mask_rule_id)
operation_result = None
try:
operation_result = self.client.delete_data_mask_rule(data_mask_rule_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_data_mask_rule, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_data_source_and_wait_for_state(self, data_source_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_data_source` and waits for the :py:class:`~oci.cloud_guard.models.WorkRequest`
to enter the given state(s).
:param str data_source_id: (required)
Data source OCID.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_data_source`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = None
try:
operation_result = self.client.delete_data_source(data_source_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
if 'opc-work-request-id' not in operation_result.headers:
return operation_result
wait_for_resource_id = operation_result.headers['opc-work-request-id']
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_work_request(wait_for_resource_id),
evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_detector_recipe_and_wait_for_state(self, detector_recipe_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_detector_recipe` and waits for the :py:class:`~oci.cloud_guard.models.DetectorRecipe` acted upon
to enter the given state(s).
:param str detector_recipe_id: (required)
Detector recipe OCID
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DetectorRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_detector_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_detector_recipe(detector_recipe_id)
operation_result = None
try:
operation_result = self.client.delete_detector_recipe(detector_recipe_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_detector_recipe, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_managed_list_and_wait_for_state(self, managed_list_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_managed_list` and waits for the :py:class:`~oci.cloud_guard.models.ManagedList` acted upon
to enter the given state(s).
:param str managed_list_id: (required)
The managed list OCID to be passed in the request.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.ManagedList.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_managed_list`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_managed_list(managed_list_id)
operation_result = None
try:
operation_result = self.client.delete_managed_list(managed_list_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_managed_list, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_responder_recipe_and_wait_for_state(self, responder_recipe_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_responder_recipe` and waits for the :py:class:`~oci.cloud_guard.models.ResponderRecipe` acted upon
to enter the given state(s).
:param str responder_recipe_id: (required)
OCID of the responder recipe.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.ResponderRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_responder_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_responder_recipe(responder_recipe_id)
operation_result = None
try:
operation_result = self.client.delete_responder_recipe(responder_recipe_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_responder_recipe, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_saved_query_and_wait_for_state(self, saved_query_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_saved_query` and waits for the :py:class:`~oci.cloud_guard.models.SavedQuery` acted upon
to enter the given state(s).
:param str saved_query_id: (required)
Saved query OCID
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SavedQuery.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_saved_query`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_saved_query(saved_query_id)
operation_result = None
try:
operation_result = self.client.delete_saved_query(saved_query_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_saved_query, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_security_recipe_and_wait_for_state(self, security_recipe_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_security_recipe` and waits for the :py:class:`~oci.cloud_guard.models.SecurityRecipe` acted upon
to enter the given state(s).
:param str security_recipe_id: (required)
The unique identifier of the security zone recipe. (`SecurityRecipe`)
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_security_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_security_recipe(security_recipe_id)
operation_result = None
try:
operation_result = self.client.delete_security_recipe(security_recipe_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_security_recipe, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_security_zone_and_wait_for_state(self, security_zone_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_security_zone` and waits for the :py:class:`~oci.cloud_guard.models.SecurityZone` acted upon
to enter the given state(s).
:param str security_zone_id: (required)
The unique identifier of the security zone (`SecurityZone` resource).
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityZone.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_security_zone`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_security_zone(security_zone_id)
operation_result = None
try:
operation_result = self.client.delete_security_zone(security_zone_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_security_zone, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def delete_target_and_wait_for_state(self, target_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.delete_target` and waits for the :py:class:`~oci.cloud_guard.models.Target` acted upon
to enter the given state(s).
:param str target_id: (required)
OCID of the target
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.Target.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.delete_target`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
initial_get_result = self.client.get_target(target_id)
operation_result = None
try:
operation_result = self.client.delete_target(target_id, **operation_kwargs)
except oci.exceptions.ServiceError as e:
if e.status == 404:
return WAIT_RESOURCE_NOT_FOUND
else:
raise e
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
try:
if ("succeed_on_not_found" in waiter_kwargs) and (waiter_kwargs["succeed_on_not_found"] is False):
self.client.base_client.logger.warning("The waiter kwarg succeed_on_not_found was passed as False for the delete composite operation delete_target, this would result in the operation to fail if the resource is not found! Please, do not pass this kwarg if this was not intended")
else:
"""
If the user does not send in this value, we set it to True by default.
We are doing this because during a delete resource scenario and waiting on its state, the service can
return a 404 NOT FOUND exception as the resource was deleted and a get on its state would fail
"""
waiter_kwargs["succeed_on_not_found"] = True
waiter_result = oci.wait_until(
self.client,
initial_get_result, # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def remove_compartment_and_wait_for_state(self, security_zone_id, remove_compartment_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.remove_compartment` and waits for the :py:class:`~oci.cloud_guard.models.SecurityZone` acted upon
to enter the given state(s).
:param str security_zone_id: (required)
The unique identifier of the security zone (`SecurityZone` resource).
:param oci.cloud_guard.models.RemoveCompartmentDetails remove_compartment_details: (required)
The compartment to remove from the security zone
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityZone.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.remove_compartment`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.remove_compartment(security_zone_id, remove_compartment_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
security_zone_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_security_zone(security_zone_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_data_mask_rule_and_wait_for_state(self, data_mask_rule_id, update_data_mask_rule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_data_mask_rule` and waits for the :py:class:`~oci.cloud_guard.models.DataMaskRule` acted upon
to enter the given state(s).
:param str data_mask_rule_id: (required)
OCID of the data mask rule
:param oci.cloud_guard.models.UpdateDataMaskRuleDetails update_data_mask_rule_details: (required)
The data mask rule information to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DataMaskRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_data_mask_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_data_mask_rule(data_mask_rule_id, update_data_mask_rule_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
data_mask_rule_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_data_mask_rule(data_mask_rule_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_data_source_and_wait_for_state(self, data_source_id, update_data_source_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_data_source` and waits for the :py:class:`~oci.cloud_guard.models.WorkRequest`
to enter the given state(s).
:param str data_source_id: (required)
Data source OCID.
:param oci.cloud_guard.models.UpdateDataSourceDetails update_data_source_details: (required)
Details for the DataSource resource to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_data_source`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_data_source(data_source_id, update_data_source_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
if 'opc-work-request-id' not in operation_result.headers:
return operation_result
wait_for_resource_id = operation_result.headers['opc-work-request-id']
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_work_request(wait_for_resource_id),
evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_detector_recipe_and_wait_for_state(self, detector_recipe_id, update_detector_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_detector_recipe` and waits for the :py:class:`~oci.cloud_guard.models.DetectorRecipe` acted upon
to enter the given state(s).
:param str detector_recipe_id: (required)
Detector recipe OCID
:param oci.cloud_guard.models.UpdateDetectorRecipeDetails update_detector_recipe_details: (required)
Details for the DetectorRecipe to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DetectorRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_detector_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_detector_recipe(detector_recipe_id, update_detector_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
detector_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_detector_recipe(detector_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_detector_recipe_detector_rule_and_wait_for_state(self, detector_recipe_id, detector_rule_id, update_detector_recipe_detector_rule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_detector_recipe_detector_rule` and waits for the :py:class:`~oci.cloud_guard.models.DetectorRecipeDetectorRule` acted upon
to enter the given state(s).
:param str detector_recipe_id: (required)
Detector recipe OCID
:param str detector_rule_id: (required)
The unique identifier of a detector rule.
:param oci.cloud_guard.models.UpdateDetectorRecipeDetectorRuleDetails update_detector_recipe_detector_rule_details: (required)
The details to be updated for DetectorRule
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.DetectorRecipeDetectorRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_detector_recipe_detector_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_detector_recipe_detector_rule(detector_recipe_id, detector_rule_id, update_detector_recipe_detector_rule_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
detector_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_detector_recipe_detector_rule(detector_recipe_id, detector_rule_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_managed_list_and_wait_for_state(self, managed_list_id, update_managed_list_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_managed_list` and waits for the :py:class:`~oci.cloud_guard.models.ManagedList` acted upon
to enter the given state(s).
:param str managed_list_id: (required)
The managed list OCID to be passed in the request.
:param oci.cloud_guard.models.UpdateManagedListDetails update_managed_list_details: (required)
Details for the ManagedList resource to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.ManagedList.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_managed_list`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_managed_list(managed_list_id, update_managed_list_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
managed_list_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_managed_list(managed_list_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_problem_status_and_wait_for_state(self, problem_id, update_problem_status_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_problem_status` and waits for the :py:class:`~oci.cloud_guard.models.Problem` acted upon
to enter the given state(s).
:param str problem_id: (required)
OCID of the problem.
:param oci.cloud_guard.models.UpdateProblemStatusDetails update_problem_status_details: (required)
The additional details for the problem
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.Problem.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_problem_status`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_problem_status(problem_id, update_problem_status_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
problem_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_problem(problem_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_responder_recipe_and_wait_for_state(self, responder_recipe_id, update_responder_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_responder_recipe` and waits for the :py:class:`~oci.cloud_guard.models.ResponderRecipe` acted upon
to enter the given state(s).
:param str responder_recipe_id: (required)
OCID of the responder recipe.
:param oci.cloud_guard.models.UpdateResponderRecipeDetails update_responder_recipe_details: (required)
The details to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.ResponderRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_responder_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_responder_recipe(responder_recipe_id, update_responder_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
responder_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_responder_recipe(responder_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_responder_recipe_responder_rule_and_wait_for_state(self, responder_recipe_id, responder_rule_id, update_responder_recipe_responder_rule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_responder_recipe_responder_rule` and waits for the :py:class:`~oci.cloud_guard.models.ResponderRecipeResponderRule` acted upon
to enter the given state(s).
:param str responder_recipe_id: (required)
OCID of the responder recipe.
:param str responder_rule_id: (required)
Unique identifier of the responder rule.
:param oci.cloud_guard.models.UpdateResponderRecipeResponderRuleDetails update_responder_recipe_responder_rule_details: (required)
The details to be updated for responder rule
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.ResponderRecipeResponderRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_responder_recipe_responder_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_responder_recipe_responder_rule(responder_recipe_id, responder_rule_id, update_responder_recipe_responder_rule_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
responder_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_responder_recipe_responder_rule(responder_recipe_id, responder_rule_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_saved_query_and_wait_for_state(self, saved_query_id, update_saved_query_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_saved_query` and waits for the :py:class:`~oci.cloud_guard.models.SavedQuery` acted upon
to enter the given state(s).
:param str saved_query_id: (required)
Saved query OCID
:param oci.cloud_guard.models.UpdateSavedQueryDetails update_saved_query_details: (required)
Details for the SavedQuery resource to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SavedQuery.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_saved_query`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_saved_query(saved_query_id, update_saved_query_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
saved_query_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_saved_query(saved_query_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_security_recipe_and_wait_for_state(self, security_recipe_id, update_security_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_security_recipe` and waits for the :py:class:`~oci.cloud_guard.models.SecurityRecipe` acted upon
to enter the given state(s).
:param str security_recipe_id: (required)
The unique identifier of the security zone recipe. (`SecurityRecipe`)
:param oci.cloud_guard.models.UpdateSecurityRecipeDetails update_security_recipe_details: (required)
The information to be updated in the security zone recipe
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_security_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_security_recipe(security_recipe_id, update_security_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
security_recipe_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_security_recipe(security_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_security_zone_and_wait_for_state(self, security_zone_id, update_security_zone_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_security_zone` and waits for the :py:class:`~oci.cloud_guard.models.SecurityZone` acted upon
to enter the given state(s).
:param str security_zone_id: (required)
The unique identifier of the security zone (`SecurityZone` resource).
:param oci.cloud_guard.models.UpdateSecurityZoneDetails update_security_zone_details: (required)
The security zone information to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.SecurityZone.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_security_zone`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_security_zone(security_zone_id, update_security_zone_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
security_zone_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_security_zone(security_zone_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_target_and_wait_for_state(self, target_id, update_target_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_target` and waits for the :py:class:`~oci.cloud_guard.models.Target` acted upon
to enter the given state(s).
:param str target_id: (required)
OCID of the target
:param oci.cloud_guard.models.UpdateTargetDetails update_target_details: (required)
The information to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.Target.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_target`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_target(target_id, update_target_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
target_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_target(target_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_target_detector_recipe_and_wait_for_state(self, target_id, target_detector_recipe_id, update_target_detector_recipe_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_target_detector_recipe` and waits for the :py:class:`~oci.cloud_guard.models.TargetDetectorRecipe` acted upon
to enter the given state(s).
:param str target_id: (required)
OCID of the target
:param str target_detector_recipe_id: (required)
OCID of the target detector recipe.
:param oci.cloud_guard.models.UpdateTargetDetectorRecipeDetails update_target_detector_recipe_details: (required)
The details to be updated
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.TargetDetectorRecipe.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_target_detector_recipe`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_target_detector_recipe(target_id, target_detector_recipe_id, update_target_detector_recipe_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
target_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_target_detector_recipe(target_id, target_detector_recipe_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_target_detector_recipe_detector_rule_and_wait_for_state(self, target_id, target_detector_recipe_id, detector_rule_id, update_target_detector_recipe_detector_rule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_target_detector_recipe_detector_rule` and waits for the :py:class:`~oci.cloud_guard.models.TargetDetectorRecipeDetectorRule` acted upon
to enter the given state(s).
:param str target_id: (required)
OCID of the target
:param str target_detector_recipe_id: (required)
OCID of the target detector recipe.
:param str detector_rule_id: (required)
The unique identifier of the detector rule.
:param oci.cloud_guard.models.UpdateTargetDetectorRecipeDetectorRuleDetails update_target_detector_recipe_detector_rule_details: (required)
The details to be updated for the detector rule
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.TargetDetectorRecipeDetectorRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_target_detector_recipe_detector_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_target_detector_recipe_detector_rule(target_id, target_detector_recipe_id, detector_rule_id, update_target_detector_recipe_detector_rule_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
target_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_target_detector_recipe_detector_rule(target_id, target_detector_recipe_id, detector_rule_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
def update_target_responder_recipe_responder_rule_and_wait_for_state(self, target_id, target_responder_recipe_id, responder_rule_id, update_target_responder_recipe_responder_rule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.cloud_guard.CloudGuardClient.update_target_responder_recipe_responder_rule` and waits for the :py:class:`~oci.cloud_guard.models.TargetResponderRecipeResponderRule` acted upon
to enter the given state(s).
:param str target_id: (required)
OCID of the target
:param str target_responder_recipe_id: (required)
OCID of the target responder recipe.
:param str responder_rule_id: (required)
Unique identifier of the responder rule.
:param oci.cloud_guard.models.UpdateTargetResponderRecipeResponderRuleDetails update_target_responder_recipe_responder_rule_details: (required)
The details to be updated for the ResponderRule resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_guard.models.TargetResponderRecipeResponderRule.lifecycle_state`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_guard.CloudGuardClient.update_target_responder_recipe_responder_rule`
:param dict waiter_kwargs:
A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds``
as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait
"""
operation_result = self.client.update_target_responder_recipe_responder_rule(target_id, target_responder_recipe_id, responder_rule_id, update_target_responder_recipe_responder_rule_details, **operation_kwargs)
if not wait_for_states:
return operation_result
lowered_wait_for_states = [w.lower() for w in wait_for_states]
target_id = operation_result.data.id
try:
waiter_result = oci.wait_until(
self.client,
self.client.get_target_responder_recipe_responder_rule(target_id, target_responder_recipe_id, responder_rule_id), # noqa: F821
evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states,
**waiter_kwargs
)
result_to_return = waiter_result
return result_to_return
except (NameError, TypeError) as e:
if not e.args:
e.args = ('',)
e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', )
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)
except Exception as e:
raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)