File: //lib/python3.9/site-packages/oci/network_firewall/network_firewall_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: 20230501
import oci # noqa: F401
from oci.util import WAIT_RESOURCE_NOT_FOUND # noqa: F401
class NetworkFirewallClientCompositeOperations(object):
"""
This class provides a wrapper around :py:class:`~oci.network_firewall.NetworkFirewallClient` 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 NetworkFirewallClientCompositeOperations object
:param NetworkFirewallClient client:
The service client which will be wrapped by this object
"""
self.client = client
def apply_network_firewall_policy_and_wait_for_state(self, network_firewall_policy_id, apply_network_firewall_policy_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.apply_network_firewall_policy` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param oci.network_firewall.models.ApplyNetworkFirewallPolicyDetails apply_network_firewall_policy_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.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.apply_network_firewall_policy`
: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.apply_network_firewall_policy(network_firewall_policy_id, apply_network_firewall_policy_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 bulk_upload_address_lists_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_address_lists_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_address_lists` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_address_lists_details: (required)
Request Details to create the Address Lists for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_address_lists`
: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.bulk_upload_address_lists(network_firewall_policy_id, bulk_upload_address_lists_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 bulk_upload_application_groups_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_application_groups_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_application_groups` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_application_groups_details: (required)
Request Details to create the Application Group for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_application_groups`
: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.bulk_upload_application_groups(network_firewall_policy_id, bulk_upload_application_groups_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 bulk_upload_applications_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_applications_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_applications` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_applications_details: (required)
Request Details to create the Applications for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_applications`
: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.bulk_upload_applications(network_firewall_policy_id, bulk_upload_applications_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 bulk_upload_decryption_profiles_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_decryption_profiles_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_decryption_profiles` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_decryption_profiles_details: (required)
Request Details to create the Decryption Profile for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_decryption_profiles`
: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.bulk_upload_decryption_profiles(network_firewall_policy_id, bulk_upload_decryption_profiles_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 bulk_upload_decryption_rules_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_decryption_rules_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_decryption_rules` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_decryption_rules_details: (required)
Request Details to create the Decryption Rule for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_decryption_rules`
: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.bulk_upload_decryption_rules(network_firewall_policy_id, bulk_upload_decryption_rules_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 bulk_upload_mapped_secrets_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_mapped_secrets_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_mapped_secrets` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_mapped_secrets_details: (required)
Request Details to create the Mapped Secret for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_mapped_secrets`
: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.bulk_upload_mapped_secrets(network_firewall_policy_id, bulk_upload_mapped_secrets_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 bulk_upload_security_rules_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_security_rules_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_security_rules` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_security_rules_details: (required)
Request Details to create the Security Rule for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_security_rules`
: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.bulk_upload_security_rules(network_firewall_policy_id, bulk_upload_security_rules_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 bulk_upload_service_lists_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_service_lists_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_service_lists` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_service_lists_details: (required)
Request Details to create the Service List for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_service_lists`
: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.bulk_upload_service_lists(network_firewall_policy_id, bulk_upload_service_lists_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 bulk_upload_services_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_services_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_services` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_services_details: (required)
Request Details to create the Services for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_services`
: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.bulk_upload_services(network_firewall_policy_id, bulk_upload_services_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 bulk_upload_tunnel_inspection_rules_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_tunnel_inspection_rules_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_tunnel_inspection_rules` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_tunnel_inspection_rules_details: (required)
Request details to create the tunnel inspection rule for the network firewall policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_tunnel_inspection_rules`
: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.bulk_upload_tunnel_inspection_rules(network_firewall_policy_id, bulk_upload_tunnel_inspection_rules_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 bulk_upload_url_lists_and_wait_for_state(self, network_firewall_policy_id, bulk_upload_url_lists_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_url_lists` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param stream bulk_upload_url_lists_details: (required)
Request Details to create the Url Lists for the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.bulk_upload_url_lists`
: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.bulk_upload_url_lists(network_firewall_policy_id, bulk_upload_url_lists_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 change_network_firewall_compartment_and_wait_for_state(self, network_firewall_id, change_network_firewall_compartment_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.change_network_firewall_compartment` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_id: (required)
The `OCID`__ of the Network Firewall resource.
__ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
:param oci.network_firewall.models.ChangeNetworkFirewallCompartmentDetails change_network_firewall_compartment_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.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.change_network_firewall_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_network_firewall_compartment(network_firewall_id, change_network_firewall_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 clone_network_firewall_policy_and_wait_for_state(self, network_firewall_policy_id, clone_network_firewall_policy_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.clone_network_firewall_policy` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param oci.network_firewall.models.CloneNetworkFirewallPolicyDetails clone_network_firewall_policy_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.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.clone_network_firewall_policy`
: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.clone_network_firewall_policy(network_firewall_policy_id, clone_network_firewall_policy_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_network_firewall_and_wait_for_state(self, create_network_firewall_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.create_network_firewall` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param oci.network_firewall.models.CreateNetworkFirewallDetails create_network_firewall_details: (required)
Details for the new NetworkFirewall.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.create_network_firewall`
: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_network_firewall(create_network_firewall_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_network_firewall_policy_and_wait_for_state(self, create_network_firewall_policy_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.create_network_firewall_policy` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param oci.network_firewall.models.CreateNetworkFirewallPolicyDetails create_network_firewall_policy_details: (required)
Request Details to create the Network Firewall Policy Resource.
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.create_network_firewall_policy`
: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_network_firewall_policy(create_network_firewall_policy_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 delete_network_firewall_and_wait_for_state(self, network_firewall_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.delete_network_firewall` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_id: (required)
The `OCID`__ of the Network Firewall resource.
__ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.delete_network_firewall`
: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_network_firewall(network_firewall_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_network_firewall_policy_and_wait_for_state(self, network_firewall_policy_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.delete_network_firewall_policy` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.delete_network_firewall_policy`
: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_network_firewall_policy(network_firewall_policy_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 migrate_network_firewall_policy_and_wait_for_state(self, network_firewall_policy_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.migrate_network_firewall_policy` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param list[str] wait_for_states:
An array of states to wait on. These should be valid values for :py:attr:`~oci.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.migrate_network_firewall_policy`
: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.migrate_network_firewall_policy(network_firewall_policy_id, **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_network_firewall_and_wait_for_state(self, network_firewall_id, update_network_firewall_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.update_network_firewall` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_id: (required)
The `OCID`__ of the Network Firewall resource.
__ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
:param oci.network_firewall.models.UpdateNetworkFirewallDetails update_network_firewall_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.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.update_network_firewall`
: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_network_firewall(network_firewall_id, update_network_firewall_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_network_firewall_policy_and_wait_for_state(self, network_firewall_policy_id, update_network_firewall_policy_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.network_firewall.NetworkFirewallClient.update_network_firewall_policy` and waits for the :py:class:`~oci.network_firewall.models.WorkRequest`
to enter the given state(s).
:param str network_firewall_policy_id: (required)
Unique Network Firewall Policy identifier
:param oci.network_firewall.models.UpdateNetworkFirewallPolicyDetails update_network_firewall_policy_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.network_firewall.models.WorkRequest.status`
:param dict operation_kwargs:
A dictionary of keyword arguments to pass to :py:func:`~oci.network_firewall.NetworkFirewallClient.update_network_firewall_policy`
: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_network_firewall_policy(network_firewall_policy_id, update_network_firewall_policy_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)