From 2c751dc12601cb94f28fb0d081ca5bf667608a74 Mon Sep 17 00:00:00 2001 From: Mike Ross Date: Thu, 25 Jan 2018 21:58:20 +0000 Subject: [PATCH] Releasing version 1.3.13 --- CHANGELOG.rst | 12 + docs/api/index.rst | 52 + docs/conf.py | 3 +- docs/index.rst | 1 + docs/sdk-with-proxy.rst | 32 + examples/instance_principals_examples.py | 26 + requirements.txt | 4 +- setup.py | 1 + src/oci/__init__.py | 4 +- src/oci/audit/audit_client.py | 101 +- src/oci/auth/__init__.py | 9 + src/oci/auth/auth_utils.py | 30 + src/oci/auth/certificate_retriever.py | 269 ++ src/oci/auth/federation_client.py | 148 ++ src/oci/auth/security_token_container.py | 23 + src/oci/auth/session_key_supplier.py | 46 + src/oci/auth/signers/__init__.py | 5 + ...stance_principals_security_token_signer.py | 87 + src/oci/auth/signers/security_token_signer.py | 73 + src/oci/base_client.py | 35 +- src/oci/config.py | 9 +- src/oci/core/blockstorage_client.py | 352 ++- src/oci/core/compute_client.py | 879 +++++-- .../core/models/launch_instance_details.py | 2 +- src/oci/core/virtual_network_client.py | 2186 ++++++++++++----- src/oci/database/database_client.py | 935 +++++-- src/oci/identity/identity_client.py | 1874 ++++++++++---- src/oci/identity/models/__init__.py | 6 + src/oci/identity/models/compartment.py | 28 +- .../models/create_compartment_details.py | 28 +- .../models/create_dynamic_group_details.py | 161 ++ .../identity/models/create_group_details.py | 28 +- .../create_identity_provider_details.py | 28 +- .../identity/models/create_policy_details.py | 28 +- src/oci/identity/models/create_tag_details.py | 36 +- .../models/create_tag_namespace_details.py | 40 +- .../identity/models/create_user_details.py | 28 +- src/oci/identity/models/dynamic_group.py | 299 +++ src/oci/identity/models/group.py | 30 +- src/oci/identity/models/identity_provider.py | 28 +- src/oci/identity/models/policy.py | 28 +- src/oci/identity/models/tag.py | 54 +- src/oci/identity/models/tag_namespace.py | 54 +- .../identity/models/tag_namespace_summary.py | 54 +- src/oci/identity/models/tag_summary.py | 46 +- src/oci/identity/models/tenancy.py | 28 +- .../models/update_compartment_details.py | 28 +- .../models/update_dynamic_group_details.py | 97 + .../identity/models/update_group_details.py | 28 +- .../update_identity_provider_details.py | 28 +- .../identity/models/update_policy_details.py | 28 +- src/oci/identity/models/update_tag_details.py | 42 +- .../models/update_tag_namespace_details.py | 42 +- .../identity/models/update_user_details.py | 28 +- src/oci/identity/models/user.py | 30 +- src/oci/load_balancer/load_balancer_client.py | 743 ++++-- src/oci/load_balancer/models/__init__.py | 2 + .../models/connection_configuration.py | 136 + .../models/create_listener_details.py | 31 + src/oci/load_balancer/models/listener.py | 31 + .../load_balancer/models/listener_details.py | 31 + .../models/update_listener_details.py | 31 + src/oci/object_storage/models/bucket.py | 12 +- .../models/create_bucket_details.py | 12 +- .../models/update_bucket_details.py | 12 +- .../object_storage/object_storage_client.py | 636 +++-- src/oci/pagination/__init__.py | 2 +- src/oci/pagination/internal/__init__.py | 6 - src/oci/pagination/internal/retry.py | 199 -- src/oci/pagination/pagination_utils.py | 15 +- src/oci/regions.py | 6 + src/oci/retry/__init__.py | 20 + src/oci/retry/retry.py | 383 +++ .../internal => retry}/retry_checkers.py | 27 +- src/oci/retry/retry_sleep_utils.py | 13 + src/oci/signer.py | 108 +- src/oci/version.py | 2 +- tests/conftest.py | 7 + tests/integ/test_launch_instance_tutorial.py | 95 +- tests/integ/util.py | 9 +- tests/test_config_container.py | 37 + tests/util.py | 11 +- 82 files changed, 8536 insertions(+), 2662 deletions(-) create mode 100644 docs/sdk-with-proxy.rst create mode 100644 examples/instance_principals_examples.py create mode 100644 src/oci/auth/__init__.py create mode 100644 src/oci/auth/auth_utils.py create mode 100644 src/oci/auth/certificate_retriever.py create mode 100644 src/oci/auth/federation_client.py create mode 100644 src/oci/auth/security_token_container.py create mode 100644 src/oci/auth/session_key_supplier.py create mode 100644 src/oci/auth/signers/__init__.py create mode 100644 src/oci/auth/signers/instance_principals_security_token_signer.py create mode 100644 src/oci/auth/signers/security_token_signer.py create mode 100644 src/oci/identity/models/create_dynamic_group_details.py create mode 100644 src/oci/identity/models/dynamic_group.py create mode 100644 src/oci/identity/models/update_dynamic_group_details.py create mode 100644 src/oci/load_balancer/models/connection_configuration.py delete mode 100644 src/oci/pagination/internal/__init__.py delete mode 100644 src/oci/pagination/internal/retry.py create mode 100644 src/oci/retry/__init__.py create mode 100644 src/oci/retry/retry.py rename src/oci/{pagination/internal => retry}/retry_checkers.py (85%) create mode 100644 src/oci/retry/retry_sleep_utils.py create mode 100644 tests/test_config_container.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1fad17ea4f..ce8c7ab7a2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_. +==================== +1.3.13 - 2018-01-25 +==================== + +Added +----- +* Support for using the ``ObjectReadWithoutList`` public access type when creating and updating buckets +* Support for dynamic groups in Identity Service +* Support for instance principals authentication when calling OCI services. An example of how to use instance principals authentication can be found on `GitHub `_. +* Support for configuring idle timeout for listeners in Load Balancer Service +* Support for VNC console connections in Compute Service + ==================== 1.3.12 - 2018-01-11 ==================== diff --git a/docs/api/index.rst b/docs/api/index.rst index 2522bb50a8..166c5fef34 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -216,6 +216,58 @@ Load Balancer .. autoclass:: Signer +===================== + Additional Signers +===================== + +.. module:: oci.auth.signers + +.. autoclass:: SecurityTokenSigner + :special-members: __init__ + :members: + +.. autoclass:: X509FederationClientBasedSecurityTokenSigner + :special-members: __init__ + :members: + +.. autoclass:: InstancePrincipalsSecurityTokenSigner + :special-members: __init__ + :members: + +============================ +X509 Certificate Retrievers +============================ + +.. module:: oci.auth.certificate_retriever + +.. autoclass:: UrlBasedCertificateRetriever + :special-members: __init__ + :members: + +.. autoclass:: PEMStringCertificateRetriever + :special-members: __init__ + :members: + +.. autoclass:: FileBasedCertificateRetriever + :special-members: __init__ + :members: + +==================================== +X509 Certificate Federation Client +==================================== + +.. module:: oci.auth.federation_client + +.. autoclass:: X509FederationClient + :special-members: __init__ + :members: + +.. module:: oci.auth.session_key_supplier + +.. autoclass:: SessionKeySupplier + :special-members: __init__ + :members: + =========== Utilities =========== diff --git a/docs/conf.py b/docs/conf.py index 95ef31fb10..f6c6893b4a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +import datetime import sys import pkg_resources import sphinx_rtd_theme @@ -22,7 +23,7 @@ # General information about the project. project = "oci" -copyright = "2016, 2017, Oracle" +copyright = "2016, {}, Oracle".format(datetime.datetime.now().year) author = "Oracle" try: diff --git a/docs/index.rst b/docs/index.rst index facc37bef9..065ef2d5ed 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -54,6 +54,7 @@ To get started, head over to the :ref:`installation instructions ` or s raw-requests waiters pagination + sdk-with-proxy api/index contributions notifications diff --git a/docs/sdk-with-proxy.rst b/docs/sdk-with-proxy.rst new file mode 100644 index 0000000000..e469cb3490 --- /dev/null +++ b/docs/sdk-with-proxy.rst @@ -0,0 +1,32 @@ +.. _sdk-with-proxy: + +.. raw:: html + + + +Using the SDK with a proxy server +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The Python SDK uses the `Requests `_ library to make calls to OCI services. If your environment requires you to use a proxy server for outgoing HTTP requests +then you can set this up in the following ways: + +* Configuring environment variable as described `here `_ +* Modifying the underlying Requests `Session `_ object for a service client + +In order to modify the underlying Session object, you can do something similar to: + +.. code-block:: python + + import oci + + config = oci.config.from_file() + compute = oci.core.ComputeClient(config) + + compute.base_client.session.proxies = { 'https': 'proxy.example.org:80' } + +The key parts are that the underlying Session object can be accessed via ``base_client.session`` and we can then modify the `proxies `_ +dictionary to add any required proxies. diff --git a/examples/instance_principals_examples.py b/examples/instance_principals_examples.py new file mode 100644 index 0000000000..d41e4b8792 --- /dev/null +++ b/examples/instance_principals_examples.py @@ -0,0 +1,26 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +import oci + +compartment_id = '' + +# By default this will hit the auth service in the region returned by http://169.254.169.254/opc/v1/instance/region on the instance. +signer = oci.auth.signers.InstancePrincipalsSecurityTokenSigner() + +# In the base case, configuration does not need to be provided as the region and tenancy are obtained from the InstancePrincipalsSecurityTokenSigner +identity_client = oci.identity.IdentityClient(config={}, signer=signer) + +print(identity_client.list_regions().data) +print(identity_client.list_availability_domains(compartment_id=compartment_id).data) + +# If you explicitly specify a region in configuration, it will be honoured. In the below example, you can also change the region later by doing: +# +# object_storage_client.base_client.set_region('us-ashburn-1') +# +# You can also explicitly set an endpoint via: +# +# object_storage_client.base_client.set_endpoint('https://') +object_storage_client = oci.object_storage.ObjectStorageClient(config={'region': 'us-ashburn-1'}, signer=signer) +print(object_storage_client.get_namespace().data) +print(object_storage_client.list_buckets(namespace_name=object_storage_client.get_namespace().data, compartment_id=compartment_id).data) diff --git a/requirements.txt b/requirements.txt index 34d4a5d4a7..8ff456ab79 100755 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ cryptography==2.1.3 flake8==3.5.0 httpsig_cffi==15.0.0 mock==2.0.0 +PyJWT==1.5.3 pyOpenSSL==17.4.0 pytest==3.2.3 pytest-catchlog==1.2.2 @@ -15,4 +16,5 @@ sphinx-rtd-theme==0.1.9 six==1.11.0 sphinx==1.6.4 tox==2.9.1 -wheel==0.29.0 \ No newline at end of file +vcrpy==1.11.1 +wheel==0.29.0 diff --git a/setup.py b/setup.py index 978d0dfd6e..05371202cf 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ def open_relative(*path): "configparser==3.5.0", "cryptography==2.1.3", "httpsig_cffi==15.0.0", + "PyJWT==1.5.3", "pyOpenSSL<=17.4.0", "python-dateutil==2.5.3", "pytz==2016.10", diff --git a/src/oci/__init__.py b/src/oci/__init__.py index 23423aaf41..125eae786e 100644 --- a/src/oci/__init__.py +++ b/src/oci/__init__.py @@ -2,7 +2,7 @@ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. from . import audit, core, database, identity, load_balancer, object_storage -from . import config, constants, decorators, exceptions, regions, pagination +from . import auth, config, constants, decorators, exceptions, regions, pagination, retry from .base_client import BaseClient from .request import Request from .response import Response @@ -12,6 +12,6 @@ __all__ = [ - "BaseClient", "Error", "Request", "Response", "Signer", "config", "constants", "decorators", "exceptions", "regions", "wait_until", "pagination", + "BaseClient", "Error", "Request", "Response", "Signer", "config", "constants", "decorators", "exceptions", "regions", "wait_until", "pagination", "auth", "retry", "audit", "core", "database", "identity", "load_balancer", "object_storage" ] diff --git a/src/oci/audit/audit_client.py b/src/oci/audit/audit_client.py index e1d4ce52f4..ab7f0bdb5d 100644 --- a/src/oci/audit/audit_client.py +++ b/src/oci/audit/audit_client.py @@ -3,8 +3,10 @@ from __future__ import absolute_import +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -15,16 +17,19 @@ class AuditClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("audit", config, signer, audit_type_mapping) def get_configuration(self, compartment_id, **kwargs): @@ -42,9 +47,11 @@ def get_configuration(self, compartment_id, **kwargs): resource_path = "/configuration" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_configuration got unknown kwargs: {!r}".format(kwargs)) + "get_configuration got unknown kwargs: {!r}".format(extra_kwargs)) query_params = { "compartmentId": compartment_id @@ -56,12 +63,21 @@ def get_configuration(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="Configuration") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="Configuration") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="Configuration") def list_events(self, compartment_id, start_time, end_time, **kwargs): """ @@ -101,6 +117,7 @@ def list_events(self, compartment_id, start_time, end_time, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "opc_request_id" ] @@ -124,12 +141,21 @@ def list_events(self, compartment_id, start_time, end_time, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[AuditEvent]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[AuditEvent]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[AuditEvent]") def update_configuration(self, compartment_id, update_configuration_details, **kwargs): """ @@ -149,9 +175,11 @@ def update_configuration(self, compartment_id, update_configuration_details, **k resource_path = "/configuration" method = "PUT" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "update_configuration got unknown kwargs: {!r}".format(kwargs)) + "update_configuration got unknown kwargs: {!r}".format(extra_kwargs)) query_params = { "compartmentId": compartment_id @@ -163,9 +191,18 @@ def update_configuration(self, compartment_id, update_configuration_details, **k "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - body=update_configuration_details) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + body=update_configuration_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + body=update_configuration_details) diff --git a/src/oci/auth/__init__.py b/src/oci/auth/__init__.py new file mode 100644 index 0000000000..e86a338d14 --- /dev/null +++ b/src/oci/auth/__init__.py @@ -0,0 +1,9 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from . import auth_utils # noqa: F401 +from . import certificate_retriever # noqa: F401 +from . import federation_client # noqa: F401 +from . import security_token_container # noqa: F401 +from . import session_key_supplier # noqa: F401 +from . import signers # noqa: F401 diff --git a/src/oci/auth/auth_utils.py b/src/oci/auth/auth_utils.py new file mode 100644 index 0000000000..b22b79ad05 --- /dev/null +++ b/src/oci/auth/auth_utils.py @@ -0,0 +1,30 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +import six + + +def get_tenancy_id_from_certificate(cert): + if not cert: + raise RuntimeError('A certificate must be provided') + + for name_attribute in cert.subject: + val = name_attribute.value + if val.startswith('opc-tenant:'): + return val[len('opc-tenant:'):] + + raise RuntimeError('The certificate does not contain a tenancy OCID') + + +def sanitize_certificate_string(cert_string): + if six.PY3: + string_to_replace = cert_string.decode('ascii') + else: + string_to_replace = cert_string + + return string_to_replace \ + .replace('-----BEGIN CERTIFICATE-----', '') \ + .replace('-----END CERTIFICATE-----', '') \ + .replace('-----BEGIN PUBLIC KEY-----', '') \ + .replace('-----END PUBLIC KEY-----', '') \ + .replace('\n', '') diff --git a/src/oci/auth/certificate_retriever.py b/src/oci/auth/certificate_retriever.py new file mode 100644 index 0000000000..adafb1be9f --- /dev/null +++ b/src/oci/auth/certificate_retriever.py @@ -0,0 +1,269 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from cryptography import x509 +from cryptography.hazmat.backends import default_backend + +import os.path +import requests +import six +import threading + + +# An abstract class which defines the interface via which certificates (and their corresponding private key) can be retrieved. +# Implementors should define their own concrete fetching mechanism (e.g. a URL, from a file, from provided PEM-format strings) +# but they are expected to be able to vend information in various ways: +# +# - A dictionary containing all certificate and private key information. This is defined as: +# - certificate: the certificate PEM string +# - private_key_pem: the private key PEM string +# - private_key: the private key as a cryptography.io X509 certificate object +# - The certificate as a cryptography.io X509 certificate object +# - The certificate PEM string +# - The private key PEM string +# - The private key as a cryptography.io X509 certificate object +# +# Certificates are optionally refreshable via a refresh() method. Where the refresh may not make sense (e.g. if the PEM-format strings +# are provided directly), implementors should make refersh() a no-op rather than throwing an exception. +class AbstractCertificateRetriever(object): + def __init__(self, **kwargs): + self.certificate_and_private_key = { + 'certificate': None, + 'private_key_pem': None, + 'private_key': None + } + + # Refreshes the certificates held by this object (e.g. because they have been rotated) + def refresh(self): + raise NotImplementedError('Subclasses should implement this') + + # Returns the certificate_and_private_key dictionary contained by this object + def get_certificate_and_private_key(self): + raise NotImplementedError('Subclasses should implement this') + + # Retrieves the certificate as a cryptography.x509.Certificate + def get_certificate_as_certificate(self): + raise NotImplementedError('Subclasses should implement this') + + # Retrieves a string containing the certificate contents + def get_certificate_raw(self): + raise NotImplementedError('Subclasses should implement this') + + # Retrievea a string containing the PEM-encoded private key + def get_private_key_pem(self): + raise NotImplementedError('Subclasses should implement this') + + # Retrieves the private key as a cryptography private key + def get_private_key(self): + raise NotImplementedError('Subclasses should implement this') + + +class UrlBasedCertificateRetriever(AbstractCertificateRetriever): + """ + A certificate retriever which reads PEM-format strings from URLs. + + :param str certificate_url: + The URL from which to retrieve a certificate. It is assumed that what we retrieve is the PEM-formatted string for the certificate. + This is mandatory + + :param str private_key_url (optional): + The URL from which to retrieve the private key corresponding to certificate_url (if any). It is assumed that what we retrieve is the PEM-formatted string for + the private key. + + :param str passphrase (optional): + The passphrase of the private key (if any). + """ + + READ_CHUNK_BYTES = 1024 * 1024 # A mebibyte + + def __init__(self, **kwargs): + super(UrlBasedCertificateRetriever, self).__init__() + + if 'certificate_url' not in kwargs: + raise TypeError('certificate_url must be supplied as a keyword argument') + + self.cert_url = kwargs['certificate_url'] + self.private_key_url = kwargs.get('private_key_url') + self.passphrase = kwargs.get('passphrase') + + if self.passphrase and isinstance(self.passphrase, six.text_type): + self.passphrase = self.passphrase.encode('ascii') + + self._refresh_lock = threading.Lock() + + self.refresh() + + def refresh(self): + import oci.signer + + self._refresh_lock.acquire() + try: + downloaded_certificate = six.BytesIO() + response = requests.get(self.cert_url, stream=True) + for chunk in response.raw.stream(self.READ_CHUNK_BYTES, decode_content=False): + downloaded_certificate.write(chunk) + + self.certificate_and_private_key['certificate'] = downloaded_certificate.getvalue().strip() + downloaded_certificate.close() + if isinstance(self.certificate_and_private_key['certificate'], six.text_type): + self.certificate_and_private_key['certificate'] = self.certificate_and_private_key['certificate'].encode('ascii') + + if self.private_key_url: + downloaded_private_key_raw = six.BytesIO() + response = requests.get(self.private_key_url, stream=True) + for chunk in response.raw.stream(self.READ_CHUNK_BYTES, decode_content=False): + downloaded_private_key_raw.write(chunk) + + self.certificate_and_private_key['private_key_pem'] = downloaded_private_key_raw.getvalue().strip() + downloaded_private_key_raw.close() + + if isinstance(self.certificate_and_private_key['private_key_pem'], six.text_type): + self.certificate_and_private_key['private_key_pem'] = self.certificate_and_private_key['private_key_pem'].encode('ascii') + + self.certificate_and_private_key['private_key'] = oci.signer.load_private_key( + self.certificate_and_private_key['private_key_pem'], + self.passphrase + ) + finally: + self._refresh_lock.release() + + def get_certificate_and_private_key(self): + self._refresh_lock.acquire() + ret_val = self.certificate_and_private_key.copy() + self._refresh_lock.release() + + return ret_val + + def get_certificate_as_certificate(self): + raw_cert = self.get_certificate_raw() + if raw_cert: + return x509.load_pem_x509_certificate(raw_cert, default_backend()) + else: + return None + + def get_certificate_raw(self): + self._refresh_lock.acquire() + certificate = self.certificate_and_private_key.copy()['certificate'] + self._refresh_lock.release() + + return certificate + + def get_private_key_pem(self): + self._refresh_lock.acquire() + private_key = self.certificate_and_private_key.copy()['private_key_pem'] + self._refresh_lock.release() + + return private_key + + def get_private_key(self): + self._refresh_lock.acquire() + private_key = self.certificate_and_private_key.copy()['private_key'] + self._refresh_lock.release() + + return private_key + + +class PEMStringCertificateRetriever(AbstractCertificateRetriever): + """ + A certificate retriever which is provided PEM format strings directly. This retriever is non-refreshable, and calling refresh() is a no-op. + + :param str certificate_pem: + The PEM-formatted string of the certificate. This is mandatory. + + :param str private_key_pem (optional): + The PEM-formatted string of the private key corresponding to certificate_pem (if any). + + :param str passphrase (optional): + The passphrase of the private key (if any). + """ + + def __init__(self, **kwargs): + import oci.signer + + super(UrlBasedCertificateRetriever, self).__init__() + + if 'certificate_pem' not in kwargs: + raise TypeError('certificate_pem must be supplied as a keyword argument') + + if isinstance(kwargs['certificate_pem'], six.text_type): + self.certificate_and_private_key['certificate'] = kwargs['certificate_pem'].encode('ascii') + else: + self.certificate_and_private_key['certificate'] = kwargs['certificate_pem'] + + if 'private_key_pem' in kwargs and kwargs['private_key_pem']: + if isinstance(kwargs['private_key_pem'], six.text_type): + self.certificate_and_private_key['private_key_pem'] = kwargs['private_key_pem'].encode('ascii') + else: + self.certificate_and_private_key['private_key_pem'] = kwargs['private_key_pem'] + + if 'passphrase' in kwargs and kwargs['passphrase']: + passphrase = kwargs['passphrase'].encode('ascii') + else: + passphrase = None + + self.certificate_and_private_key['private_key'] = oci.signer.load_private_key( + self.certificate_and_private_key['private_key_pem'], + passphrase + ) + + def refresh(self): + # Since these are just the string, there is no refresh as such. A new object should be created + # if the strings change + pass + + def get_certificate_and_private_key(self): + return self.certificate_and_private_key.copy() + + def get_certificate_as_certificate(self): + return x509.load_pem_x509_certificate(self.certificate_and_private_key['certificate'], default_backend()) + + def get_certificate_raw(self): + return self.certificate_and_private_key['certificate'] + + def get_private_key_pem(self): + return self.certificate_and_private_key['private_key_pem'] + + def get_private_key(self): + return self.certificate_and_private_key['private_key'] + + +class FileBasedCertificateRetriever(PEMStringCertificateRetriever): + """ + A specialization of PEMStringCertificateRetriever which reads certificates from a file. This retriever is non-refreshable, and calling refresh() is a no-op. + + :param str certificate_file_path: + The file path from which to retrieve a certificate. It is assumed that what we retrieve is the PEM-formatted string for the certificate. + This is mandatory + + :param str private_key_pem_file_path (optional): + The file path from which to retrieve the private key corresponding to certificate_file_path (if any). It is assumed that what we retrieve is the PEM-formatted string for + the private key. + + :param str passphrase (optional): + The passphrase of the private key (if any). + + """ + + def __init__(self, **kwargs): + if 'certificate_file_path' not in kwargs: + raise TypeError('certificate_file_path must be supplied as a keyword argument') + + if 'private_key_pem_file_path' in kwargs: + private_key_pem = self._load_data_from_file(kwargs['private_key_pem_file_path']) + else: + private_key_pem = None + + parent_class_kwargs = { + 'certificate_pem': self._load_data_from_file(kwargs['certificate_file_path']), + 'private_key_pem_file_path': private_key_pem, + 'passphrase': kwargs.get('passphrase') + } + + super(FileBasedCertificateRetriever, self).__init__(**parent_class_kwargs) + + def _load_data_from_file(self, filename): + filename = os.path.expanduser(filename) + with open(filename, mode="rb") as f: + cert_data = f.read().strip() + + return cert_data diff --git a/src/oci/auth/federation_client.py b/src/oci/auth/federation_client.py new file mode 100644 index 0000000000..76ad038c7a --- /dev/null +++ b/src/oci/auth/federation_client.py @@ -0,0 +1,148 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from . import auth_utils +from .security_token_container import SecurityTokenContainer +from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat +from OpenSSL import crypto + +import oci.signer +import requests +import threading + + +class X509FederationClient(object): + REQUIRED_INIT_KWARGS = [ + 'federation_endpoint', + 'tenancy_id', + 'session_key_supplier', + 'leaf_certificate_retriever' + ] + + def __init__(self, **kwargs): + """ + A client which can be used to retrieve a token from Auth Service. It needs the following supplied to it: + + - The endpoint for Auth Service + - Our tenancy OCID + - A session key supplier so that we can send its public key as part of the token request. The private key + in the session key supplier should be used to sign all requests made with the token + - The certificate (via leaf_certificate_retriever) which will be used to sign the requests to Auth Service. + + Optionally, intermediate certificates (if present) can be supplied as part of the request to Auth Service. + + The client has knowledge of its last requested token and can re-request the token if it is expired (otherwise + it will vend the last requested token if it is not expired). + + :param str federation_endpoint: + The Auth Service endpoint from which to retrieve the token. + + :param str tenancy_id: + The OCID of the tenancy whose resources will be interacted with by users of the token. + + :param SessionKeySupplier session_key_supplier: + A SessionKeySupplier that can vend a public and private key. The public key will be sent as part of the token + request and the private key should be used to sign all requests made with the token vended by this client. + + :param CertificateRetriever leaf_certificate_retriever: + The certificate which will be used to sign requests to Auth Service. + + :param list[CertificateRetriever] intermediate_certificate_retrievers (optional): + A list of retrievers which can be used to fetch intermediate certificates which can be sent as part of the Auth Service request. This is an optional parameter + + :param cert_bundle_verify (optional): + If we need a specific cert bundle in order to perform verification against the federation endpoint, this parameter is the path to that bundle. Alternatively, + False can be passed to disable verification. + :type cert_bundle_verify: str or Boolean + """ + + kwarg_keys = kwargs.keys() + missing_keys = [] + + for required in self.REQUIRED_INIT_KWARGS: + if required not in kwarg_keys: + missing_keys.append(required) + elif not kwargs[required]: + missing_keys.append(required) + + if missing_keys: + raise TypeError('The following required arguments were not provided: {}'.format(', '.join(missing_keys))) + + self.federation_endpoint = kwargs['federation_endpoint'] + self.tenancy_id = kwargs['tenancy_id'] + self.session_key_supplier = kwargs['session_key_supplier'] + self.leaf_certificate_retriever = kwargs['leaf_certificate_retriever'] + + if 'intermediate_certificate_retrievers' in kwargs and kwargs['intermediate_certificate_retrievers']: + self.intermediate_certificate_retrievers = kwargs['intermediate_certificate_retrievers'] + else: + self.intermediate_certificate_retrievers = [] + + self.cert_bundle_verify = kwargs.get('cert_bundle_verify', None) + self._refresh_lock = threading.Lock() + + def refresh_security_token(self): + return self._refresh_security_token_inner() + + def get_security_token(self): + if hasattr(self, 'security_token'): + if self.security_token.valid(): + return self.security_token.security_token + + return self._refresh_security_token_inner() + + def _refresh_security_token_inner(self): + self._refresh_lock.acquire() + try: + self.session_key_supplier.refresh() + self.leaf_certificate_retriever.refresh() + + updated_tenancy_id = auth_utils.get_tenancy_id_from_certificate(self.leaf_certificate_retriever.get_certificate_as_certificate()) + if updated_tenancy_id != self.tenancy_id: + raise RuntimeError('Unexpected update of tenancy OCID in the leaf certificate. Previous tenancy: {}, Updated: {}'.format(self.tenancy_id, updated_tenancy_id)) + + for retriever in self.intermediate_certificate_retrievers: + retriever.refresh() + + self._get_security_token_from_auth_service() + return self.security_token.security_token + finally: + self._refresh_lock.release() + + def _get_security_token_from_auth_service(self): + request_payload = { + 'certificate': auth_utils.sanitize_certificate_string(self.leaf_certificate_retriever.get_certificate_raw()), + 'publicKey': auth_utils.sanitize_certificate_string(self.session_key_supplier.get_key_pair()['public'].public_bytes(Encoding.PEM, PublicFormat.SubjectPublicKeyInfo)) + } + + if self.intermediate_certificate_retrievers: + retrieved_certs = [] + for retriever in self.intermediate_certificate_retrievers: + retrieved_certs.append(auth_utils.sanitize_certificate_string(retriever.get_certificate_raw())) + + request_payload['intermediateCertificates'] = retrieved_certs + + fingerprint = crypto.load_certificate(crypto.FILETYPE_PEM, self.leaf_certificate_retriever.get_certificate_raw()).digest('sha1').decode('utf-8') + signer = AuthTokenRequestSigner(self.tenancy_id, fingerprint, self.leaf_certificate_retriever) + + if self.cert_bundle_verify: + response = requests.post(self.federation_endpoint, json=request_payload, auth=signer, verify=self.cert_bundle_verify) + else: + response = requests.post(self.federation_endpoint, json=request_payload, auth=signer) + self.security_token = SecurityTokenContainer(self.session_key_supplier, response.json()['token']) + + +class AuthTokenRequestSigner(oci.signer.AbstractBaseSigner): + """ + A signer intended for X509FederationClient's use to request a token from Auth Service. Not intended for general use. + + + """ + + def __init__(self, tenancy_id, fingerprint, private_key_certificate_retriever): + self.api_key = '{}/fed-x509/{}'.format(tenancy_id, fingerprint) + self.private_key_certificate_retriever = private_key_certificate_retriever + + generic_headers = ["date", "(request-target)"] + body_headers = ["content-length", "content-type", "x-content-sha256"] + self.create_signers(self.api_key, self.private_key_certificate_retriever.get_private_key(), generic_headers, body_headers) diff --git a/src/oci/auth/security_token_container.py b/src/oci/auth/security_token_container.py new file mode 100644 index 0000000000..bba97f22ac --- /dev/null +++ b/src/oci/auth/security_token_container.py @@ -0,0 +1,23 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +import jwt +import time + + +class SecurityTokenContainer(object): + def __init__(self, session_key_supplier, security_token): + self.security_token = security_token + self.session_key_supplier = session_key_supplier + self.jwt = jwt.decode(jwt=security_token, verify=False) + + def get_jwt(self): + return self.jwt + + def valid(self): + return not self._expired() + + def _expired(self): + # The exp key which PyJWT returns is in epoch seconds + time_now = int(time.time()) + return time_now > self.jwt['exp'] diff --git a/src/oci/auth/session_key_supplier.py b/src/oci/auth/session_key_supplier.py new file mode 100644 index 0000000000..ac2f84b2c0 --- /dev/null +++ b/src/oci/auth/session_key_supplier.py @@ -0,0 +1,46 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives.asymmetric import rsa + +import threading + + +class SessionKeySupplier(object): + # Magic number recommended by cryptography.io docs. Also see: http://www.daemonology.net/blog/2009-06-11-cryptographic-right-answers.html + PUBLIC_EXPONENT = 65537 + + def __init__(self, key_size=2048): + """ + A supplier which vends public and private keys, and can refresh the keys it uses. + + :param int key_size (optional): + The key size to use when generating private keys. Defaults to 2048 if not provided. + """ + self.key_size = key_size + self.private_key = rsa.generate_private_key( + public_exponent=self.PUBLIC_EXPONENT, + key_size=self.key_size, + backend=default_backend() + ) + + self._refresh_lock = threading.Lock() + + def get_key_pair(self): + self._refresh_lock.acquire() + private_key = self.private_key + self._refresh_lock.release() + + return {'private': private_key, 'public': private_key.public_key()} + + def refresh(self): + self._refresh_lock.acquire() + try: + self.private_key = rsa.generate_private_key( + public_exponent=self.PUBLIC_EXPONENT, + key_size=self.key_size, + backend=default_backend() + ) + finally: + self._refresh_lock.release() diff --git a/src/oci/auth/signers/__init__.py b/src/oci/auth/signers/__init__.py new file mode 100644 index 0000000000..73db66c7d3 --- /dev/null +++ b/src/oci/auth/signers/__init__.py @@ -0,0 +1,5 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from .security_token_signer import SecurityTokenSigner, X509FederationClientBasedSecurityTokenSigner # noqa: F401 +from .instance_principals_security_token_signer import InstancePrincipalsSecurityTokenSigner # noqa: F401 diff --git a/src/oci/auth/signers/instance_principals_security_token_signer.py b/src/oci/auth/signers/instance_principals_security_token_signer.py new file mode 100644 index 0000000000..468456ea1d --- /dev/null +++ b/src/oci/auth/signers/instance_principals_security_token_signer.py @@ -0,0 +1,87 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from .security_token_signer import X509FederationClientBasedSecurityTokenSigner +from ..certificate_retriever import UrlBasedCertificateRetriever +from ..session_key_supplier import SessionKeySupplier +from ..federation_client import X509FederationClient +from .. import auth_utils + +import oci.regions +import requests + + +class InstancePrincipalsSecurityTokenSigner(X509FederationClientBasedSecurityTokenSigner): + """ + A SecurityTokenSigner which uses a security token for an instance principal. This signer can also + refresh its token as needed. + + This signer is self-sufficient in that its internals know how to source the required information to request and use + the token: + + * Using the metadata endpoint for the instance (http://169.254.169.254/opc/v1) we can discover the region the instance is in, its leaf certificate and any intermediate certificates (for requesting the token) and the tenancy (as) that is in the leaf certificate. + * The signer leverages X509FederationClient so it can refresh the security token and also get the private key needed to sign requests (via the client's session_key_supplier) + + This signer can be used as follows: + + .. code-block:: python + + import oci + + signer = oci.auth.signers.InstancePrincipalsSecurityTokenSigner() + identity_client = oci.identity.IdentityClient(config={}, signer=signer) + regions = identity_client.list_regions() + + :param str federation_endpoint (optional): + Users of this class can specify an explicit federation_endpoint, representing the Auth Service endpoint from which to retrieve a security token. If it is not + provided then we will construct an endpoint based on the region we read from the metadata endpoint for the instance + + :param federation_client_cert_bundle_verify (optional): + If we need a specific cert bundle in order to perform verification against the federation endpoint, this parameter is the path to that bundle. Alternatively, + False can be passed to disable verification. + :type federation_client_cert_bundle_verify: str or Boolean + """ + + METADATA_URL_BASE = 'http://169.254.169.254/opc/v1' + GET_REGION_URL = '{}/instance/region'.format(METADATA_URL_BASE) + LEAF_CERTIFICATE_URL = '{}/identity/cert.pem'.format(METADATA_URL_BASE) + LEAF_CERTIFICATE_PRIVATE_KEY_URL = '{}/identity/key.pem'.format(METADATA_URL_BASE) + INTERMEDIATE_CERTIFICATE_URL = '{}/identity/intermediate.pem'.format(METADATA_URL_BASE) + + def __init__(self, **kwargs): + self.leaf_certificate_retriever = UrlBasedCertificateRetriever(certificate_url=self.LEAF_CERTIFICATE_URL, private_key_url=self.LEAF_CERTIFICATE_PRIVATE_KEY_URL) + self.intermediate_certificate_retriever = UrlBasedCertificateRetriever(certificate_url=self.INTERMEDIATE_CERTIFICATE_URL) + self.session_key_supplier = SessionKeySupplier() + self.tenancy_id = auth_utils.get_tenancy_id_from_certificate(self.leaf_certificate_retriever.get_certificate_as_certificate()) + self.initialize_and_return_region() + + if 'federation_endpoint' in kwargs and kwargs['federation_endpoint']: + federation_endpoint = kwargs['federation_endpoint'] + else: + federation_endpoint = '{}/v1/x509'.format(oci.regions.endpoint_for('auth', self.region)) + + federation_client = X509FederationClient( + federation_endpoint=federation_endpoint, + tenancy_id=self.tenancy_id, + session_key_supplier=self.session_key_supplier, + leaf_certificate_retriever=self.leaf_certificate_retriever, + intermediate_certificate_retrievers=[self.intermediate_certificate_retriever], + cert_bundle_verify=kwargs.get('federation_client_cert_bundle_verify', None) + ) + + super(InstancePrincipalsSecurityTokenSigner, self).__init__(federation_client) + + def initialize_and_return_region(self): + if hasattr(self, 'region'): + return self.region + + response = requests.get(self.GET_REGION_URL) + region_raw = response.text.strip() + + # The region can be something like "phx" but internally we expect "us-phoenix-1", "us-ashburn-1" etc. + if region_raw in oci.regions.REGIONS_SHORT_NAMES: + self.region = oci.regions.REGIONS_SHORT_NAMES[region_raw] + else: + self.region = region_raw + + return self.region diff --git a/src/oci/auth/signers/security_token_signer.py b/src/oci/auth/signers/security_token_signer.py new file mode 100644 index 0000000000..3076c8cb66 --- /dev/null +++ b/src/oci/auth/signers/security_token_signer.py @@ -0,0 +1,73 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +import oci.signer +import threading + + +SECURITY_TOKEN_FORMAT_STRING = 'ST${}' + + +class SecurityTokenSigner(oci.signer.AbstractBaseSigner): + """ + The base signer for signing requests where the API key is a token (e.g. instance principals, service-to-service auth) rather representing + the details for a specific user. + + This class expects caller to provide the token and the private key whose corresponding public key was provided when requesting the token. + The headers to sign are also customizable but they default to: + + - date, (request-target), host as generic headers on each request + - content-length, content-type and x-content-sha256 on as additional headers requests with bodies + + + """ + + def __init__(self, token, private_key, generic_headers=["date", "(request-target)", "host"], body_headers=["content-length", "content-type", "x-content-sha256"]): + self.api_key = SECURITY_TOKEN_FORMAT_STRING.format(token) + self.private_key = private_key + + self.create_signers(self.api_key, self.private_key, generic_headers, body_headers) + + +class X509FederationClientBasedSecurityTokenSigner(SecurityTokenSigner): + """ + A SecurityTokenSigner where the token and private key are sourced from a provided X509FederationClient. The token is retrieved via the client's get_security_token() + method, and the private key is retrieved by reading it from the session_key_supplier in the client. + + The headers to sign are also customizable but they default to: + + - date, (request-target), host as generic headers on each request + - content-length, content-type and x-content-sha256 on as additional headers requests with bodies + + + """ + + def __init__(self, federation_client, generic_headers=["date", "(request-target)", "host"], body_headers=["content-length", "content-type", "x-content-sha256"]): + self.federation_client = federation_client + self._reset_signers_lock = threading.Lock() + + super(X509FederationClientBasedSecurityTokenSigner, self).__init__( + self.federation_client.get_security_token(), + self.federation_client.session_key_supplier.get_key_pair()['private'], + generic_headers=generic_headers, + body_headers=body_headers + ) + + def __call__(self, request, enforce_content_headers=True): + self._reset_signers() + return super(X509FederationClientBasedSecurityTokenSigner, self).__call__(request, enforce_content_headers) + + def refresh_security_token(self): + self.federation_client.refresh_security_token() + + def _reset_signers(self): + self._reset_signers_lock.acquire() + try: + refreshed_token = self.federation_client.get_security_token() + self.api_key = SECURITY_TOKEN_FORMAT_STRING.format(refreshed_token) + self.private_key = self.federation_client.session_key_supplier.get_key_pair()['private'] + + self._basic_signer.reset_signer(self.api_key, self.private_key) + self._body_signer.reset_signer(self.api_key, self.private_key) + finally: + self._reset_signers_lock.release() diff --git a/src/oci/base_client.py b/src/oci/base_client.py index 3da762992d..cb76258424 100644 --- a/src/oci/base_client.py +++ b/src/oci/base_client.py @@ -5,8 +5,10 @@ import json import logging import platform +import random import re import six.moves +import string import uuid from datetime import date, datetime @@ -15,6 +17,7 @@ from dateutil.parser import parse from . import constants, exceptions, regions +from .auth import signers from .config import get_config_value_or_default, validate_config from .request import Request from .response import Response @@ -62,13 +65,20 @@ class BaseClient(object): } def __init__(self, service, config, signer, type_mapping): - validate_config(config) + validate_config(config, signer=signer) self.signer = signer + + region_to_use = None + if 'region' in config and config['region']: + region_to_use = config.get('region') + elif hasattr(signer, 'region'): + region_to_use = signer.region self.endpoint = regions.endpoint_for( service, - region=config.get("region"), + region=region_to_use, endpoint=config.get("endpoint")) + self.service = service self.complex_type_mappings = type_mapping self.type_mappings = merge_type_mappings(self.primitive_type_map, type_mapping) self.session = requests.Session() @@ -82,6 +92,9 @@ def __init__(self, service, config, signer, type_mapping): else: six.moves.http_client.HTTPConnection.debuglevel = 0 + def set_region(self, region): + self.endpoint = regions.endpoint_for(self.service, region=region) + def call_api(self, resource_path, method, path_params=None, query_params=None, @@ -142,7 +155,19 @@ def call_api(self, resource_path, method, enforce_content_headers=enforce_content_headers ) - return self.request(request) + if not isinstance(self.signer, signers.InstancePrincipalsSecurityTokenSigner): + return self.request(request) + else: + call_attempts = 0 + while call_attempts < 2: + try: + return self.request(request) + except exceptions.ServiceError as e: + call_attempts += 1 + if e.status == 401 and call_attempts < 2: + self.signer.refresh_security_token() + else: + raise def process_query_params(self, query_params): query_params = self.sanitize_for_serialization(query_params) @@ -233,6 +258,10 @@ def request(self, request): def build_request_id(self): return str(uuid.uuid4()).replace('-', '').upper() + def add_opc_retry_token_if_needed(self, header_params, retry_token_length=30): + if 'opc-retry-token' not in header_params: + header_params['opc-retry-token'] = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(retry_token_length)) + def to_path_value(self, obj): """ Takes value and turn it into a string suitable for inclusion in diff --git a/src/oci/config.py b/src/oci/config.py index d22e36a5f7..5126e2b42e 100644 --- a/src/oci/config.py +++ b/src/oci/config.py @@ -30,6 +30,7 @@ import six from .exceptions import ConfigFileNotFound, ProfileNotFound, InvalidConfig +from .auth import signers __all__ = ["DEFAULT_CONFIG", "from_file", "validate_config"] @@ -89,7 +90,13 @@ def from_file(file_location=DEFAULT_LOCATION, profile_name=DEFAULT_PROFILE): return config -def validate_config(config): +def validate_config(config, **kwargs): + if 'signer' in kwargs: + # The InstancePrincipalsSecurityTokenSigner is self-sufficient and doesn't need to read + # the normally-required keys in the config + if isinstance(kwargs['signer'], signers.InstancePrincipalsSecurityTokenSigner): + return + """Raises ValueError if required fields are missing or malformed.""" errors = {} for required_key in REQUIRED: diff --git a/src/oci/core/blockstorage_client.py b/src/oci/core/blockstorage_client.py index e53256b9fc..ef45263abd 100644 --- a/src/oci/core/blockstorage_client.py +++ b/src/oci/core/blockstorage_client.py @@ -3,8 +3,10 @@ from __future__ import absolute_import +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -15,16 +17,19 @@ class BlockstorageClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("blockstorage", config, signer, core_type_mapping) def create_volume(self, create_volume_details, **kwargs): @@ -68,6 +73,7 @@ def create_volume(self, create_volume_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -82,12 +88,23 @@ def create_volume(self, create_volume_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_volume_details, - response_type="Volume") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_volume_details, + response_type="Volume") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_volume_details, + response_type="Volume") def create_volume_backup(self, create_volume_backup_details, **kwargs): """ @@ -120,6 +137,7 @@ def create_volume_backup(self, create_volume_backup_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -134,12 +152,23 @@ def create_volume_backup(self, create_volume_backup_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_volume_backup_details, - response_type="VolumeBackup") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_volume_backup_details, + response_type="VolumeBackup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_volume_backup_details, + response_type="VolumeBackup") def delete_boot_volume(self, boot_volume_id, **kwargs): """ @@ -168,6 +197,7 @@ def delete_boot_volume(self, boot_volume_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -192,11 +222,19 @@ def delete_boot_volume(self, boot_volume_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_volume(self, volume_id, **kwargs): """ @@ -225,6 +263,7 @@ def delete_volume(self, volume_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -249,11 +288,19 @@ def delete_volume(self, volume_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_volume_backup(self, volume_backup_id, **kwargs): """ @@ -277,6 +324,7 @@ def delete_volume_backup(self, volume_backup_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -301,11 +349,19 @@ def delete_volume_backup(self, volume_backup_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def get_boot_volume(self, boot_volume_id, **kwargs): """ @@ -322,9 +378,11 @@ def get_boot_volume(self, boot_volume_id, **kwargs): resource_path = "/bootVolumes/{bootVolumeId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_boot_volume got unknown kwargs: {!r}".format(kwargs)) + "get_boot_volume got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "bootVolumeId": boot_volume_id @@ -341,12 +399,21 @@ def get_boot_volume(self, boot_volume_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="BootVolume") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BootVolume") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BootVolume") def get_volume(self, volume_id, **kwargs): """ @@ -363,9 +430,11 @@ def get_volume(self, volume_id, **kwargs): resource_path = "/volumes/{volumeId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_volume got unknown kwargs: {!r}".format(kwargs)) + "get_volume got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "volumeId": volume_id @@ -382,12 +451,21 @@ def get_volume(self, volume_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Volume") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Volume") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Volume") def get_volume_backup(self, volume_backup_id, **kwargs): """ @@ -404,9 +482,11 @@ def get_volume_backup(self, volume_backup_id, **kwargs): resource_path = "/volumeBackups/{volumeBackupId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_volume_backup got unknown kwargs: {!r}".format(kwargs)) + "get_volume_backup got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "volumeBackupId": volume_backup_id @@ -423,12 +503,21 @@ def get_volume_backup(self, volume_backup_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="VolumeBackup") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VolumeBackup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VolumeBackup") def list_boot_volumes(self, availability_domain, compartment_id, **kwargs): """ @@ -460,6 +549,7 @@ def list_boot_volumes(self, availability_domain, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -481,12 +571,21 @@ def list_boot_volumes(self, availability_domain, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[BootVolume]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[BootVolume]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[BootVolume]") def list_volume_backups(self, compartment_id, **kwargs): """ @@ -542,6 +641,7 @@ def list_volume_backups(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "volume_id", "limit", "page", @@ -593,12 +693,21 @@ def list_volume_backups(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[VolumeBackup]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VolumeBackup]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VolumeBackup]") def list_volumes(self, compartment_id, **kwargs): """ @@ -656,6 +765,7 @@ def list_volumes(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "availability_domain", "limit", "page", @@ -707,12 +817,21 @@ def list_volumes(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Volume]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Volume]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Volume]") def update_boot_volume(self, boot_volume_id, update_boot_volume_details, **kwargs): """ @@ -739,6 +858,7 @@ def update_boot_volume(self, boot_volume_id, update_boot_volume_details, **kwarg # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -763,13 +883,23 @@ def update_boot_volume(self, boot_volume_id, update_boot_volume_details, **kwarg } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_boot_volume_details, - response_type="BootVolume") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_boot_volume_details, + response_type="BootVolume") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_boot_volume_details, + response_type="BootVolume") def update_volume(self, volume_id, update_volume_details, **kwargs): """ @@ -797,6 +927,7 @@ def update_volume(self, volume_id, update_volume_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -821,13 +952,23 @@ def update_volume(self, volume_id, update_volume_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_volume_details, - response_type="Volume") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_volume_details, + response_type="Volume") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_volume_details, + response_type="Volume") def update_volume_backup(self, volume_backup_id, update_volume_backup_details, **kwargs): """ @@ -855,6 +996,7 @@ def update_volume_backup(self, volume_backup_id, update_volume_backup_details, * # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -879,10 +1021,20 @@ def update_volume_backup(self, volume_backup_id, update_volume_backup_details, * } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_volume_backup_details, - response_type="VolumeBackup") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_volume_backup_details, + response_type="VolumeBackup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_volume_backup_details, + response_type="VolumeBackup") diff --git a/src/oci/core/compute_client.py b/src/oci/core/compute_client.py index b76a90efa6..69f1d22647 100644 --- a/src/oci/core/compute_client.py +++ b/src/oci/core/compute_client.py @@ -3,8 +3,10 @@ from __future__ import absolute_import +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -15,16 +17,19 @@ class ComputeClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("compute", config, signer, core_type_mapping) def attach_boot_volume(self, attach_boot_volume_details, **kwargs): @@ -51,6 +56,7 @@ def attach_boot_volume(self, attach_boot_volume_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -65,12 +71,23 @@ def attach_boot_volume(self, attach_boot_volume_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=attach_boot_volume_details, - response_type="BootVolumeAttachment") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=attach_boot_volume_details, + response_type="BootVolumeAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=attach_boot_volume_details, + response_type="BootVolumeAttachment") def attach_vnic(self, attach_vnic_details, **kwargs): """ @@ -100,6 +117,7 @@ def attach_vnic(self, attach_vnic_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -114,12 +132,23 @@ def attach_vnic(self, attach_vnic_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=attach_vnic_details, - response_type="VnicAttachment") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=attach_vnic_details, + response_type="VnicAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=attach_vnic_details, + response_type="VnicAttachment") def attach_volume(self, attach_volume_details, **kwargs): """ @@ -145,6 +174,7 @@ def attach_volume(self, attach_volume_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -159,12 +189,23 @@ def attach_volume(self, attach_volume_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=attach_volume_details, - response_type="VolumeAttachment") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=attach_volume_details, + response_type="VolumeAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=attach_volume_details, + response_type="VolumeAttachment") def capture_console_history(self, capture_console_history_details, **kwargs): """ @@ -206,6 +247,7 @@ def capture_console_history(self, capture_console_history_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -220,12 +262,23 @@ def capture_console_history(self, capture_console_history_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=capture_console_history_details, - response_type="ConsoleHistory") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=capture_console_history_details, + response_type="ConsoleHistory") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=capture_console_history_details, + response_type="ConsoleHistory") def create_image(self, create_image_details, **kwargs): """ @@ -278,6 +331,7 @@ def create_image(self, create_image_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -292,12 +346,23 @@ def create_image(self, create_image_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_image_details, - response_type="Image") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_image_details, + response_type="Image") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_image_details, + response_type="Image") def create_instance_console_connection(self, create_instance_console_connection_details, **kwargs): """ @@ -329,6 +394,7 @@ def create_instance_console_connection(self, create_instance_console_connection_ # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -343,12 +409,23 @@ def create_instance_console_connection(self, create_instance_console_connection_ } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_instance_console_connection_details, - response_type="InstanceConsoleConnection") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_instance_console_connection_details, + response_type="InstanceConsoleConnection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_instance_console_connection_details, + response_type="InstanceConsoleConnection") def delete_console_history(self, instance_console_history_id, **kwargs): """ @@ -372,6 +449,7 @@ def delete_console_history(self, instance_console_history_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -396,11 +474,19 @@ def delete_console_history(self, instance_console_history_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_image(self, image_id, **kwargs): """ @@ -424,6 +510,7 @@ def delete_image(self, image_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -448,11 +535,19 @@ def delete_image(self, image_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_instance_console_connection(self, instance_console_connection_id, **kwargs): """ @@ -476,6 +571,7 @@ def delete_instance_console_connection(self, instance_console_connection_id, **k # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -500,11 +596,19 @@ def delete_instance_console_connection(self, instance_console_connection_id, **k } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def detach_boot_volume(self, boot_volume_attachment_id, **kwargs): """ @@ -531,6 +635,7 @@ def detach_boot_volume(self, boot_volume_attachment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -555,11 +660,19 @@ def detach_boot_volume(self, boot_volume_attachment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def detach_vnic(self, vnic_attachment_id, **kwargs): """ @@ -594,6 +707,7 @@ def detach_vnic(self, vnic_attachment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -618,11 +732,19 @@ def detach_vnic(self, vnic_attachment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def detach_volume(self, volume_attachment_id, **kwargs): """ @@ -649,6 +771,7 @@ def detach_volume(self, volume_attachment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -673,11 +796,19 @@ def detach_volume(self, volume_attachment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def export_image(self, image_id, export_image_details, **kwargs): """ @@ -725,6 +856,7 @@ def export_image(self, image_id, export_image_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token", "if_match" ] @@ -751,13 +883,25 @@ def export_image(self, image_id, export_image_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=export_image_details, - response_type="Image") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=export_image_details, + response_type="Image") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=export_image_details, + response_type="Image") def get_boot_volume_attachment(self, boot_volume_attachment_id, **kwargs): """ @@ -774,9 +918,11 @@ def get_boot_volume_attachment(self, boot_volume_attachment_id, **kwargs): resource_path = "/bootVolumeAttachments/{bootVolumeAttachmentId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_boot_volume_attachment got unknown kwargs: {!r}".format(kwargs)) + "get_boot_volume_attachment got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "bootVolumeAttachmentId": boot_volume_attachment_id @@ -793,12 +939,21 @@ def get_boot_volume_attachment(self, boot_volume_attachment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="BootVolumeAttachment") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BootVolumeAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BootVolumeAttachment") def get_console_history(self, instance_console_history_id, **kwargs): """ @@ -817,9 +972,11 @@ def get_console_history(self, instance_console_history_id, **kwargs): resource_path = "/instanceConsoleHistories/{instanceConsoleHistoryId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_console_history got unknown kwargs: {!r}".format(kwargs)) + "get_console_history got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "instanceConsoleHistoryId": instance_console_history_id @@ -836,12 +993,21 @@ def get_console_history(self, instance_console_history_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="ConsoleHistory") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="ConsoleHistory") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="ConsoleHistory") def get_console_history_content(self, instance_console_history_id, **kwargs): """ @@ -868,6 +1034,7 @@ def get_console_history_content(self, instance_console_history_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "offset", "length" ] @@ -897,13 +1064,23 @@ def get_console_history_content(self, instance_console_history_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="bytes") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="bytes") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="bytes") def get_image(self, image_id, **kwargs): """ @@ -920,9 +1097,11 @@ def get_image(self, image_id, **kwargs): resource_path = "/images/{imageId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_image got unknown kwargs: {!r}".format(kwargs)) + "get_image got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "imageId": image_id @@ -939,12 +1118,21 @@ def get_image(self, image_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Image") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Image") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Image") def get_instance(self, instance_id, **kwargs): """ @@ -961,9 +1149,11 @@ def get_instance(self, instance_id, **kwargs): resource_path = "/instances/{instanceId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_instance got unknown kwargs: {!r}".format(kwargs)) + "get_instance got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "instanceId": instance_id @@ -980,12 +1170,21 @@ def get_instance(self, instance_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Instance") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Instance") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Instance") def get_instance_console_connection(self, instance_console_connection_id, **kwargs): """ @@ -1002,9 +1201,11 @@ def get_instance_console_connection(self, instance_console_connection_id, **kwar resource_path = "/instanceConsoleConnections/{instanceConsoleConnectionId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_instance_console_connection got unknown kwargs: {!r}".format(kwargs)) + "get_instance_console_connection got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "instanceConsoleConnectionId": instance_console_connection_id @@ -1021,12 +1222,21 @@ def get_instance_console_connection(self, instance_console_connection_id, **kwar "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="InstanceConsoleConnection") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="InstanceConsoleConnection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="InstanceConsoleConnection") def get_vnic_attachment(self, vnic_attachment_id, **kwargs): """ @@ -1043,9 +1253,11 @@ def get_vnic_attachment(self, vnic_attachment_id, **kwargs): resource_path = "/vnicAttachments/{vnicAttachmentId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_vnic_attachment got unknown kwargs: {!r}".format(kwargs)) + "get_vnic_attachment got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "vnicAttachmentId": vnic_attachment_id @@ -1062,12 +1274,21 @@ def get_vnic_attachment(self, vnic_attachment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="VnicAttachment") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VnicAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VnicAttachment") def get_volume_attachment(self, volume_attachment_id, **kwargs): """ @@ -1084,9 +1305,11 @@ def get_volume_attachment(self, volume_attachment_id, **kwargs): resource_path = "/volumeAttachments/{volumeAttachmentId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_volume_attachment got unknown kwargs: {!r}".format(kwargs)) + "get_volume_attachment got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "volumeAttachmentId": volume_attachment_id @@ -1103,12 +1326,21 @@ def get_volume_attachment(self, volume_attachment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="VolumeAttachment") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VolumeAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VolumeAttachment") def get_windows_instance_initial_credentials(self, instance_id, **kwargs): """ @@ -1126,9 +1358,11 @@ def get_windows_instance_initial_credentials(self, instance_id, **kwargs): resource_path = "/instances/{instanceId}/initialCredentials" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_windows_instance_initial_credentials got unknown kwargs: {!r}".format(kwargs)) + "get_windows_instance_initial_credentials got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "instanceId": instance_id @@ -1145,12 +1379,21 @@ def get_windows_instance_initial_credentials(self, instance_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="InstanceCredentials") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="InstanceCredentials") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="InstanceCredentials") def instance_action(self, instance_id, action, **kwargs): """ @@ -1201,6 +1444,7 @@ def instance_action(self, instance_id, action, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token", "if_match" ] @@ -1232,13 +1476,25 @@ def instance_action(self, instance_id, action, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="Instance") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="Instance") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="Instance") def launch_instance(self, launch_instance_details, **kwargs): """ @@ -1299,6 +1555,7 @@ def launch_instance(self, launch_instance_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1313,12 +1570,23 @@ def launch_instance(self, launch_instance_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=launch_instance_details, - response_type="Instance") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=launch_instance_details, + response_type="Instance") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=launch_instance_details, + response_type="Instance") def list_boot_volume_attachments(self, availability_domain, compartment_id, **kwargs): """ @@ -1357,6 +1625,7 @@ def list_boot_volume_attachments(self, availability_domain, compartment_id, **kw # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "instance_id", @@ -1382,12 +1651,21 @@ def list_boot_volume_attachments(self, availability_domain, compartment_id, **kw "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[BootVolumeAttachment]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[BootVolumeAttachment]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[BootVolumeAttachment]") def list_console_histories(self, compartment_id, **kwargs): """ @@ -1445,6 +1723,7 @@ def list_console_histories(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "availability_domain", "limit", "page", @@ -1496,12 +1775,21 @@ def list_console_histories(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[ConsoleHistory]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[ConsoleHistory]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[ConsoleHistory]") def list_images(self, compartment_id, **kwargs): """ @@ -1570,6 +1858,7 @@ def list_images(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "display_name", "operating_system", "operating_system_version", @@ -1623,12 +1912,21 @@ def list_images(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Image]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Image]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Image]") def list_instance_console_connections(self, compartment_id, **kwargs): """ @@ -1662,6 +1960,7 @@ def list_instance_console_connections(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "instance_id", "limit", "page" @@ -1684,12 +1983,21 @@ def list_instance_console_connections(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[InstanceConsoleConnection]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[InstanceConsoleConnection]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[InstanceConsoleConnection]") def list_instances(self, compartment_id, **kwargs): """ @@ -1749,6 +2057,7 @@ def list_instances(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "availability_domain", "display_name", "limit", @@ -1800,12 +2109,21 @@ def list_instances(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Instance]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Instance]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Instance]") def list_shapes(self, compartment_id, **kwargs): """ @@ -1841,6 +2159,7 @@ def list_shapes(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "availability_domain", "limit", "page", @@ -1865,12 +2184,21 @@ def list_shapes(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Shape]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Shape]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Shape]") def list_vnic_attachments(self, compartment_id, **kwargs): """ @@ -1910,6 +2238,7 @@ def list_vnic_attachments(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "availability_domain", "instance_id", "limit", @@ -1936,12 +2265,21 @@ def list_vnic_attachments(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[VnicAttachment]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VnicAttachment]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VnicAttachment]") def list_volume_attachments(self, compartment_id, **kwargs): """ @@ -1982,6 +2320,7 @@ def list_volume_attachments(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "availability_domain", "limit", "page", @@ -2008,12 +2347,21 @@ def list_volume_attachments(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[VolumeAttachment]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VolumeAttachment]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VolumeAttachment]") def terminate_instance(self, instance_id, **kwargs): """ @@ -2048,6 +2396,7 @@ def terminate_instance(self, instance_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "preserve_boot_volume" ] @@ -2078,12 +2427,21 @@ def terminate_instance(self, instance_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) def update_console_history(self, instance_console_history_id, update_console_history_details, **kwargs): """ @@ -2110,6 +2468,7 @@ def update_console_history(self, instance_console_history_id, update_console_his # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2134,13 +2493,23 @@ def update_console_history(self, instance_console_history_id, update_console_his } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_console_history_details, - response_type="ConsoleHistory") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_console_history_details, + response_type="ConsoleHistory") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_console_history_details, + response_type="ConsoleHistory") def update_image(self, image_id, update_image_details, **kwargs): """ @@ -2174,6 +2543,7 @@ def update_image(self, image_id, update_image_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token", "if_match" ] @@ -2200,13 +2570,25 @@ def update_image(self, image_id, update_image_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_image_details, - response_type="Image") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_image_details, + response_type="Image") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_image_details, + response_type="Image") def update_instance(self, instance_id, update_instance_details, **kwargs): """ @@ -2241,6 +2623,7 @@ def update_instance(self, instance_id, update_instance_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token", "if_match" ] @@ -2267,10 +2650,22 @@ def update_instance(self, instance_id, update_instance_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_instance_details, - response_type="Instance") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_instance_details, + response_type="Instance") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_instance_details, + response_type="Instance") diff --git a/src/oci/core/models/launch_instance_details.py b/src/oci/core/models/launch_instance_details.py index 99193d81ba..c5788acbac 100644 --- a/src/oci/core/models/launch_instance_details.py +++ b/src/oci/core/models/launch_instance_details.py @@ -361,7 +361,7 @@ def hostname_label(self, hostname_label): @property def image_id(self): """ - **[Required]** Gets the image_id of this LaunchInstanceDetails. + Gets the image_id of this LaunchInstanceDetails. Deprecated. Use `sourceDetails` with :func:`instance_source_via_image_details` source type instead. If you specify values for both, the values must match. diff --git a/src/oci/core/virtual_network_client.py b/src/oci/core/virtual_network_client.py index ab9992b434..af8a13868c 100644 --- a/src/oci/core/virtual_network_client.py +++ b/src/oci/core/virtual_network_client.py @@ -3,8 +3,10 @@ from __future__ import absolute_import +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -15,16 +17,19 @@ class VirtualNetworkClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("virtual_network", config, signer, core_type_mapping) def bulk_add_virtual_circuit_public_prefixes(self, virtual_circuit_id, bulk_add_virtual_circuit_public_prefixes_details, **kwargs): @@ -48,9 +53,11 @@ def bulk_add_virtual_circuit_public_prefixes(self, virtual_circuit_id, bulk_add_ resource_path = "/virtualCircuits/{virtualCircuitId}/actions/bulkAddPublicPrefixes" method = "POST" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "bulk_add_virtual_circuit_public_prefixes got unknown kwargs: {!r}".format(kwargs)) + "bulk_add_virtual_circuit_public_prefixes got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "virtualCircuitId": virtual_circuit_id @@ -67,12 +74,21 @@ def bulk_add_virtual_circuit_public_prefixes(self, virtual_circuit_id, bulk_add_ "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=bulk_add_virtual_circuit_public_prefixes_details) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=bulk_add_virtual_circuit_public_prefixes_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=bulk_add_virtual_circuit_public_prefixes_details) def bulk_delete_virtual_circuit_public_prefixes(self, virtual_circuit_id, bulk_delete_virtual_circuit_public_prefixes_details, **kwargs): """ @@ -95,9 +111,11 @@ def bulk_delete_virtual_circuit_public_prefixes(self, virtual_circuit_id, bulk_d resource_path = "/virtualCircuits/{virtualCircuitId}/actions/bulkDeletePublicPrefixes" method = "POST" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "bulk_delete_virtual_circuit_public_prefixes got unknown kwargs: {!r}".format(kwargs)) + "bulk_delete_virtual_circuit_public_prefixes got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "virtualCircuitId": virtual_circuit_id @@ -114,12 +132,21 @@ def bulk_delete_virtual_circuit_public_prefixes(self, virtual_circuit_id, bulk_d "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=bulk_delete_virtual_circuit_public_prefixes_details) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=bulk_delete_virtual_circuit_public_prefixes_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=bulk_delete_virtual_circuit_public_prefixes_details) def connect_local_peering_gateways(self, local_peering_gateway_id, connect_local_peering_gateways_details, **kwargs): """ @@ -148,9 +175,11 @@ def connect_local_peering_gateways(self, local_peering_gateway_id, connect_local resource_path = "/localPeeringGateways/{localPeeringGatewayId}/actions/connect" method = "POST" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "connect_local_peering_gateways got unknown kwargs: {!r}".format(kwargs)) + "connect_local_peering_gateways got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "localPeeringGatewayId": local_peering_gateway_id @@ -167,12 +196,21 @@ def connect_local_peering_gateways(self, local_peering_gateway_id, connect_local "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=connect_local_peering_gateways_details) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=connect_local_peering_gateways_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=connect_local_peering_gateways_details) def create_cpe(self, create_cpe_details, **kwargs): """ @@ -217,6 +255,7 @@ def create_cpe(self, create_cpe_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -231,12 +270,23 @@ def create_cpe(self, create_cpe_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_cpe_details, - response_type="Cpe") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_cpe_details, + response_type="Cpe") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_cpe_details, + response_type="Cpe") def create_cross_connect(self, create_cross_connect_details, **kwargs): """ @@ -284,6 +334,7 @@ def create_cross_connect(self, create_cross_connect_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -298,12 +349,23 @@ def create_cross_connect(self, create_cross_connect_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_cross_connect_details, - response_type="CrossConnect") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_cross_connect_details, + response_type="CrossConnect") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_cross_connect_details, + response_type="CrossConnect") def create_cross_connect_group(self, create_cross_connect_group_details, **kwargs): """ @@ -347,6 +409,7 @@ def create_cross_connect_group(self, create_cross_connect_group_details, **kwarg # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -361,12 +424,23 @@ def create_cross_connect_group(self, create_cross_connect_group_details, **kwarg } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_cross_connect_group_details, - response_type="CrossConnectGroup") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_cross_connect_group_details, + response_type="CrossConnectGroup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_cross_connect_group_details, + response_type="CrossConnectGroup") def create_dhcp_options(self, create_dhcp_details, **kwargs): """ @@ -406,6 +480,7 @@ def create_dhcp_options(self, create_dhcp_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -420,12 +495,23 @@ def create_dhcp_options(self, create_dhcp_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_dhcp_details, - response_type="DhcpOptions") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_dhcp_details, + response_type="DhcpOptions") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_dhcp_details, + response_type="DhcpOptions") def create_drg(self, create_drg_details, **kwargs): """ @@ -466,6 +552,7 @@ def create_drg(self, create_drg_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -480,12 +567,23 @@ def create_drg(self, create_drg_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_drg_details, - response_type="Drg") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_drg_details, + response_type="Drg") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_drg_details, + response_type="Drg") def create_drg_attachment(self, create_drg_attachment_details, **kwargs): """ @@ -524,6 +622,7 @@ def create_drg_attachment(self, create_drg_attachment_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -538,12 +637,23 @@ def create_drg_attachment(self, create_drg_attachment_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_drg_attachment_details, - response_type="DrgAttachment") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_drg_attachment_details, + response_type="DrgAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_drg_attachment_details, + response_type="DrgAttachment") def create_internet_gateway(self, create_internet_gateway_details, **kwargs): """ @@ -593,6 +703,7 @@ def create_internet_gateway(self, create_internet_gateway_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -607,12 +718,23 @@ def create_internet_gateway(self, create_internet_gateway_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_internet_gateway_details, - response_type="InternetGateway") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_internet_gateway_details, + response_type="InternetGateway") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_internet_gateway_details, + response_type="InternetGateway") def create_ip_sec_connection(self, create_ip_sec_connection_details, **kwargs): """ @@ -668,6 +790,7 @@ def create_ip_sec_connection(self, create_ip_sec_connection_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -682,12 +805,23 @@ def create_ip_sec_connection(self, create_ip_sec_connection_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_ip_sec_connection_details, - response_type="IPSecConnection") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_ip_sec_connection_details, + response_type="IPSecConnection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_ip_sec_connection_details, + response_type="IPSecConnection") def create_local_peering_gateway(self, create_local_peering_gateway_details, **kwargs): """ @@ -713,6 +847,7 @@ def create_local_peering_gateway(self, create_local_peering_gateway_details, **k # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -727,12 +862,23 @@ def create_local_peering_gateway(self, create_local_peering_gateway_details, **k } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_local_peering_gateway_details, - response_type="LocalPeeringGateway") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_local_peering_gateway_details, + response_type="LocalPeeringGateway") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_local_peering_gateway_details, + response_type="LocalPeeringGateway") def create_private_ip(self, create_private_ip_details, **kwargs): """ @@ -762,6 +908,7 @@ def create_private_ip(self, create_private_ip_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -776,12 +923,23 @@ def create_private_ip(self, create_private_ip_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_private_ip_details, - response_type="PrivateIp") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_private_ip_details, + response_type="PrivateIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_private_ip_details, + response_type="PrivateIp") def create_route_table(self, create_route_table_details, **kwargs): """ @@ -826,6 +984,7 @@ def create_route_table(self, create_route_table_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -840,12 +999,23 @@ def create_route_table(self, create_route_table_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_route_table_details, - response_type="RouteTable") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_route_table_details, + response_type="RouteTable") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_route_table_details, + response_type="RouteTable") def create_security_list(self, create_security_list_details, **kwargs): """ @@ -889,6 +1059,7 @@ def create_security_list(self, create_security_list_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -903,12 +1074,23 @@ def create_security_list(self, create_security_list_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_security_list_details, - response_type="SecurityList") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_security_list_details, + response_type="SecurityList") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_security_list_details, + response_type="SecurityList") def create_subnet(self, create_subnet_details, **kwargs): """ @@ -973,6 +1155,7 @@ def create_subnet(self, create_subnet_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -987,12 +1170,23 @@ def create_subnet(self, create_subnet_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_subnet_details, - response_type="Subnet") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_subnet_details, + response_type="Subnet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_subnet_details, + response_type="Subnet") def create_vcn(self, create_vcn_details, **kwargs): """ @@ -1053,6 +1247,7 @@ def create_vcn(self, create_vcn_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1067,12 +1262,23 @@ def create_vcn(self, create_vcn_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_vcn_details, - response_type="Vcn") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_vcn_details, + response_type="Vcn") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_vcn_details, + response_type="Vcn") def create_virtual_circuit(self, create_virtual_circuit_details, **kwargs): """ @@ -1123,6 +1329,7 @@ def create_virtual_circuit(self, create_virtual_circuit_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1137,12 +1344,23 @@ def create_virtual_circuit(self, create_virtual_circuit_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_virtual_circuit_details, - response_type="VirtualCircuit") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_virtual_circuit_details, + response_type="VirtualCircuit") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_virtual_circuit_details, + response_type="VirtualCircuit") def delete_cpe(self, cpe_id, **kwargs): """ @@ -1168,6 +1386,7 @@ def delete_cpe(self, cpe_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1192,11 +1411,19 @@ def delete_cpe(self, cpe_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_cross_connect(self, cross_connect_id, **kwargs): """ @@ -1221,6 +1448,7 @@ def delete_cross_connect(self, cross_connect_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1245,11 +1473,19 @@ def delete_cross_connect(self, cross_connect_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_cross_connect_group(self, cross_connect_group_id, **kwargs): """ @@ -1275,6 +1511,7 @@ def delete_cross_connect_group(self, cross_connect_group_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1299,11 +1536,19 @@ def delete_cross_connect_group(self, cross_connect_group_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_dhcp_options(self, dhcp_id, **kwargs): """ @@ -1331,6 +1576,7 @@ def delete_dhcp_options(self, dhcp_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1355,11 +1601,19 @@ def delete_dhcp_options(self, dhcp_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_drg(self, drg_id, **kwargs): """ @@ -1386,6 +1640,7 @@ def delete_drg(self, drg_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1410,11 +1665,19 @@ def delete_drg(self, drg_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_drg_attachment(self, drg_attachment_id, **kwargs): """ @@ -1440,6 +1703,7 @@ def delete_drg_attachment(self, drg_attachment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1464,11 +1728,19 @@ def delete_drg_attachment(self, drg_attachment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_internet_gateway(self, ig_id, **kwargs): """ @@ -1496,6 +1768,7 @@ def delete_internet_gateway(self, ig_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1520,11 +1793,19 @@ def delete_internet_gateway(self, ig_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_ip_sec_connection(self, ipsc_id, **kwargs): """ @@ -1555,6 +1836,7 @@ def delete_ip_sec_connection(self, ipsc_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1579,11 +1861,19 @@ def delete_ip_sec_connection(self, ipsc_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_local_peering_gateway(self, local_peering_gateway_id, **kwargs): """ @@ -1610,6 +1900,7 @@ def delete_local_peering_gateway(self, local_peering_gateway_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1634,11 +1925,19 @@ def delete_local_peering_gateway(self, local_peering_gateway_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_private_ip(self, private_ip_id, **kwargs): """ @@ -1674,6 +1973,7 @@ def delete_private_ip(self, private_ip_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1698,11 +1998,19 @@ def delete_private_ip(self, private_ip_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_route_table(self, rt_id, **kwargs): """ @@ -1730,6 +2038,7 @@ def delete_route_table(self, rt_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1754,11 +2063,19 @@ def delete_route_table(self, rt_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_security_list(self, security_list_id, **kwargs): """ @@ -1786,6 +2103,7 @@ def delete_security_list(self, security_list_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1810,11 +2128,19 @@ def delete_security_list(self, security_list_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_subnet(self, subnet_id, **kwargs): """ @@ -1840,6 +2166,7 @@ def delete_subnet(self, subnet_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1864,11 +2191,19 @@ def delete_subnet(self, subnet_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_vcn(self, vcn_id, **kwargs): """ @@ -1894,6 +2229,7 @@ def delete_vcn(self, vcn_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1918,11 +2254,19 @@ def delete_vcn(self, vcn_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_virtual_circuit(self, virtual_circuit_id, **kwargs): """ @@ -1950,6 +2294,7 @@ def delete_virtual_circuit(self, virtual_circuit_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1974,11 +2319,19 @@ def delete_virtual_circuit(self, virtual_circuit_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def get_cpe(self, cpe_id, **kwargs): """ @@ -1995,9 +2348,11 @@ def get_cpe(self, cpe_id, **kwargs): resource_path = "/cpes/{cpeId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_cpe got unknown kwargs: {!r}".format(kwargs)) + "get_cpe got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "cpeId": cpe_id @@ -2014,12 +2369,21 @@ def get_cpe(self, cpe_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Cpe") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Cpe") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Cpe") def get_cross_connect(self, cross_connect_id, **kwargs): """ @@ -2036,9 +2400,11 @@ def get_cross_connect(self, cross_connect_id, **kwargs): resource_path = "/crossConnects/{crossConnectId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_cross_connect got unknown kwargs: {!r}".format(kwargs)) + "get_cross_connect got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "crossConnectId": cross_connect_id @@ -2055,12 +2421,21 @@ def get_cross_connect(self, cross_connect_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="CrossConnect") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="CrossConnect") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="CrossConnect") def get_cross_connect_group(self, cross_connect_group_id, **kwargs): """ @@ -2077,9 +2452,11 @@ def get_cross_connect_group(self, cross_connect_group_id, **kwargs): resource_path = "/crossConnectGroups/{crossConnectGroupId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_cross_connect_group got unknown kwargs: {!r}".format(kwargs)) + "get_cross_connect_group got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "crossConnectGroupId": cross_connect_group_id @@ -2096,12 +2473,21 @@ def get_cross_connect_group(self, cross_connect_group_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="CrossConnectGroup") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="CrossConnectGroup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="CrossConnectGroup") def get_cross_connect_letter_of_authority(self, cross_connect_id, **kwargs): """ @@ -2118,9 +2504,11 @@ def get_cross_connect_letter_of_authority(self, cross_connect_id, **kwargs): resource_path = "/crossConnects/{crossConnectId}/letterOfAuthority" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_cross_connect_letter_of_authority got unknown kwargs: {!r}".format(kwargs)) + "get_cross_connect_letter_of_authority got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "crossConnectId": cross_connect_id @@ -2137,12 +2525,21 @@ def get_cross_connect_letter_of_authority(self, cross_connect_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="LetterOfAuthority") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LetterOfAuthority") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LetterOfAuthority") def get_cross_connect_status(self, cross_connect_id, **kwargs): """ @@ -2159,9 +2556,11 @@ def get_cross_connect_status(self, cross_connect_id, **kwargs): resource_path = "/crossConnects/{crossConnectId}/status" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_cross_connect_status got unknown kwargs: {!r}".format(kwargs)) + "get_cross_connect_status got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "crossConnectId": cross_connect_id @@ -2178,12 +2577,21 @@ def get_cross_connect_status(self, cross_connect_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="CrossConnectStatus") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="CrossConnectStatus") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="CrossConnectStatus") def get_dhcp_options(self, dhcp_id, **kwargs): """ @@ -2200,9 +2608,11 @@ def get_dhcp_options(self, dhcp_id, **kwargs): resource_path = "/dhcps/{dhcpId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_dhcp_options got unknown kwargs: {!r}".format(kwargs)) + "get_dhcp_options got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dhcpId": dhcp_id @@ -2219,12 +2629,21 @@ def get_dhcp_options(self, dhcp_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="DhcpOptions") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DhcpOptions") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DhcpOptions") def get_drg(self, drg_id, **kwargs): """ @@ -2241,9 +2660,11 @@ def get_drg(self, drg_id, **kwargs): resource_path = "/drgs/{drgId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_drg got unknown kwargs: {!r}".format(kwargs)) + "get_drg got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "drgId": drg_id @@ -2260,12 +2681,21 @@ def get_drg(self, drg_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Drg") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Drg") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Drg") def get_drg_attachment(self, drg_attachment_id, **kwargs): """ @@ -2282,9 +2712,11 @@ def get_drg_attachment(self, drg_attachment_id, **kwargs): resource_path = "/drgAttachments/{drgAttachmentId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_drg_attachment got unknown kwargs: {!r}".format(kwargs)) + "get_drg_attachment got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "drgAttachmentId": drg_attachment_id @@ -2301,12 +2733,21 @@ def get_drg_attachment(self, drg_attachment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="DrgAttachment") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DrgAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DrgAttachment") def get_fast_connect_provider_service(self, provider_service_id, **kwargs): """ @@ -2326,9 +2767,11 @@ def get_fast_connect_provider_service(self, provider_service_id, **kwargs): resource_path = "/fastConnectProviderServices/{providerServiceId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_fast_connect_provider_service got unknown kwargs: {!r}".format(kwargs)) + "get_fast_connect_provider_service got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "providerServiceId": provider_service_id @@ -2345,12 +2788,21 @@ def get_fast_connect_provider_service(self, provider_service_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="FastConnectProviderService") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="FastConnectProviderService") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="FastConnectProviderService") def get_internet_gateway(self, ig_id, **kwargs): """ @@ -2367,9 +2819,11 @@ def get_internet_gateway(self, ig_id, **kwargs): resource_path = "/internetGateways/{igId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_internet_gateway got unknown kwargs: {!r}".format(kwargs)) + "get_internet_gateway got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "igId": ig_id @@ -2386,12 +2840,21 @@ def get_internet_gateway(self, ig_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="InternetGateway") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="InternetGateway") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="InternetGateway") def get_ip_sec_connection(self, ipsc_id, **kwargs): """ @@ -2410,9 +2873,11 @@ def get_ip_sec_connection(self, ipsc_id, **kwargs): resource_path = "/ipsecConnections/{ipscId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_ip_sec_connection got unknown kwargs: {!r}".format(kwargs)) + "get_ip_sec_connection got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "ipscId": ipsc_id @@ -2429,12 +2894,21 @@ def get_ip_sec_connection(self, ipsc_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="IPSecConnection") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IPSecConnection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IPSecConnection") def get_ip_sec_connection_device_config(self, ipsc_id, **kwargs): """ @@ -2452,9 +2926,11 @@ def get_ip_sec_connection_device_config(self, ipsc_id, **kwargs): resource_path = "/ipsecConnections/{ipscId}/deviceConfig" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_ip_sec_connection_device_config got unknown kwargs: {!r}".format(kwargs)) + "get_ip_sec_connection_device_config got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "ipscId": ipsc_id @@ -2471,12 +2947,21 @@ def get_ip_sec_connection_device_config(self, ipsc_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="IPSecConnectionDeviceConfig") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IPSecConnectionDeviceConfig") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IPSecConnectionDeviceConfig") def get_ip_sec_connection_device_status(self, ipsc_id, **kwargs): """ @@ -2493,9 +2978,11 @@ def get_ip_sec_connection_device_status(self, ipsc_id, **kwargs): resource_path = "/ipsecConnections/{ipscId}/deviceStatus" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_ip_sec_connection_device_status got unknown kwargs: {!r}".format(kwargs)) + "get_ip_sec_connection_device_status got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "ipscId": ipsc_id @@ -2512,12 +2999,21 @@ def get_ip_sec_connection_device_status(self, ipsc_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="IPSecConnectionDeviceStatus") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IPSecConnectionDeviceStatus") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IPSecConnectionDeviceStatus") def get_local_peering_gateway(self, local_peering_gateway_id, **kwargs): """ @@ -2534,9 +3030,11 @@ def get_local_peering_gateway(self, local_peering_gateway_id, **kwargs): resource_path = "/localPeeringGateways/{localPeeringGatewayId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_local_peering_gateway got unknown kwargs: {!r}".format(kwargs)) + "get_local_peering_gateway got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "localPeeringGatewayId": local_peering_gateway_id @@ -2553,12 +3051,21 @@ def get_local_peering_gateway(self, local_peering_gateway_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="LocalPeeringGateway") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LocalPeeringGateway") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LocalPeeringGateway") def get_private_ip(self, private_ip_id, **kwargs): """ @@ -2578,9 +3085,11 @@ def get_private_ip(self, private_ip_id, **kwargs): resource_path = "/privateIps/{privateIpId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_private_ip got unknown kwargs: {!r}".format(kwargs)) + "get_private_ip got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "privateIpId": private_ip_id @@ -2597,12 +3106,21 @@ def get_private_ip(self, private_ip_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="PrivateIp") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PrivateIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PrivateIp") def get_route_table(self, rt_id, **kwargs): """ @@ -2619,9 +3137,11 @@ def get_route_table(self, rt_id, **kwargs): resource_path = "/routeTables/{rtId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_route_table got unknown kwargs: {!r}".format(kwargs)) + "get_route_table got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "rtId": rt_id @@ -2638,12 +3158,21 @@ def get_route_table(self, rt_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="RouteTable") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="RouteTable") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="RouteTable") def get_security_list(self, security_list_id, **kwargs): """ @@ -2660,9 +3189,11 @@ def get_security_list(self, security_list_id, **kwargs): resource_path = "/securityLists/{securityListId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_security_list got unknown kwargs: {!r}".format(kwargs)) + "get_security_list got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "securityListId": security_list_id @@ -2679,12 +3210,21 @@ def get_security_list(self, security_list_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="SecurityList") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="SecurityList") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="SecurityList") def get_subnet(self, subnet_id, **kwargs): """ @@ -2701,9 +3241,11 @@ def get_subnet(self, subnet_id, **kwargs): resource_path = "/subnets/{subnetId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_subnet got unknown kwargs: {!r}".format(kwargs)) + "get_subnet got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "subnetId": subnet_id @@ -2720,12 +3262,21 @@ def get_subnet(self, subnet_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Subnet") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Subnet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Subnet") def get_vcn(self, vcn_id, **kwargs): """ @@ -2742,9 +3293,11 @@ def get_vcn(self, vcn_id, **kwargs): resource_path = "/vcns/{vcnId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_vcn got unknown kwargs: {!r}".format(kwargs)) + "get_vcn got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "vcnId": vcn_id @@ -2761,12 +3314,21 @@ def get_vcn(self, vcn_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Vcn") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Vcn") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Vcn") def get_virtual_circuit(self, virtual_circuit_id, **kwargs): """ @@ -2783,9 +3345,11 @@ def get_virtual_circuit(self, virtual_circuit_id, **kwargs): resource_path = "/virtualCircuits/{virtualCircuitId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_virtual_circuit got unknown kwargs: {!r}".format(kwargs)) + "get_virtual_circuit got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "virtualCircuitId": virtual_circuit_id @@ -2802,12 +3366,21 @@ def get_virtual_circuit(self, virtual_circuit_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="VirtualCircuit") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VirtualCircuit") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VirtualCircuit") def get_vnic(self, vnic_id, **kwargs): """ @@ -2827,9 +3400,11 @@ def get_vnic(self, vnic_id, **kwargs): resource_path = "/vnics/{vnicId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_vnic got unknown kwargs: {!r}".format(kwargs)) + "get_vnic got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "vnicId": vnic_id @@ -2846,12 +3421,21 @@ def get_vnic(self, vnic_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Vnic") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Vnic") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Vnic") def list_cpes(self, compartment_id, **kwargs): """ @@ -2878,6 +3462,7 @@ def list_cpes(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -2898,12 +3483,21 @@ def list_cpes(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Cpe]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Cpe]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Cpe]") def list_cross_connect_groups(self, compartment_id, **kwargs): """ @@ -2956,6 +3550,7 @@ def list_cross_connect_groups(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -3005,12 +3600,21 @@ def list_cross_connect_groups(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[CrossConnectGroup]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnectGroup]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnectGroup]") def list_cross_connect_locations(self, compartment_id, **kwargs): """ @@ -3038,6 +3642,7 @@ def list_cross_connect_locations(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -3058,12 +3663,21 @@ def list_cross_connect_locations(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[CrossConnectLocation]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnectLocation]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnectLocation]") def list_cross_connects(self, compartment_id, **kwargs): """ @@ -3120,6 +3734,7 @@ def list_cross_connects(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "cross_connect_group_id", "limit", "page", @@ -3171,12 +3786,21 @@ def list_cross_connects(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[CrossConnect]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnect]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnect]") def list_crossconnect_port_speed_shapes(self, compartment_id, **kwargs): """ @@ -3205,6 +3829,7 @@ def list_crossconnect_port_speed_shapes(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -3225,12 +3850,21 @@ def list_crossconnect_port_speed_shapes(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[CrossConnectPortSpeedShape]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnectPortSpeedShape]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[CrossConnectPortSpeedShape]") def list_dhcp_options(self, compartment_id, vcn_id, **kwargs): """ @@ -3288,6 +3922,7 @@ def list_dhcp_options(self, compartment_id, vcn_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -3338,12 +3973,21 @@ def list_dhcp_options(self, compartment_id, vcn_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DhcpOptions]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DhcpOptions]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DhcpOptions]") def list_drg_attachments(self, compartment_id, **kwargs): """ @@ -3377,6 +4021,7 @@ def list_drg_attachments(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "vcn_id", "drg_id", "limit", @@ -3401,12 +4046,21 @@ def list_drg_attachments(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DrgAttachment]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DrgAttachment]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DrgAttachment]") def list_drgs(self, compartment_id, **kwargs): """ @@ -3433,6 +4087,7 @@ def list_drgs(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -3453,12 +4108,21 @@ def list_drgs(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Drg]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Drg]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Drg]") def list_fast_connect_provider_services(self, compartment_id, **kwargs): """ @@ -3493,6 +4157,7 @@ def list_fast_connect_provider_services(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -3513,12 +4178,21 @@ def list_fast_connect_provider_services(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[FastConnectProviderService]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[FastConnectProviderService]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[FastConnectProviderService]") def list_fast_connect_provider_virtual_circuit_bandwidth_shapes(self, provider_service_id, **kwargs): """ @@ -3550,6 +4224,7 @@ def list_fast_connect_provider_virtual_circuit_bandwidth_shapes(self, provider_s # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -3579,13 +4254,23 @@ def list_fast_connect_provider_virtual_circuit_bandwidth_shapes(self, provider_s "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[VirtualCircuitBandwidthShape]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuitBandwidthShape]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuitBandwidthShape]") def list_internet_gateways(self, compartment_id, vcn_id, **kwargs): """ @@ -3641,6 +4326,7 @@ def list_internet_gateways(self, compartment_id, vcn_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -3691,12 +4377,21 @@ def list_internet_gateways(self, compartment_id, vcn_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[InternetGateway]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[InternetGateway]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[InternetGateway]") def list_ip_sec_connections(self, compartment_id, **kwargs): """ @@ -3730,6 +4425,7 @@ def list_ip_sec_connections(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "drg_id", "cpe_id", "limit", @@ -3754,12 +4450,21 @@ def list_ip_sec_connections(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[IPSecConnection]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[IPSecConnection]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[IPSecConnection]") def list_local_peering_gateways(self, compartment_id, vcn_id, **kwargs): """ @@ -3790,6 +4495,7 @@ def list_local_peering_gateways(self, compartment_id, vcn_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -3811,12 +4517,21 @@ def list_local_peering_gateways(self, compartment_id, vcn_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[LocalPeeringGateway]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LocalPeeringGateway]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LocalPeeringGateway]") def list_private_ips(self, **kwargs): """ @@ -3863,6 +4578,7 @@ def list_private_ips(self, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "ip_address", @@ -3888,12 +4604,21 @@ def list_private_ips(self, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[PrivateIp]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[PrivateIp]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[PrivateIp]") def list_route_tables(self, compartment_id, vcn_id, **kwargs): """ @@ -3951,6 +4676,7 @@ def list_route_tables(self, compartment_id, vcn_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -4001,12 +4727,21 @@ def list_route_tables(self, compartment_id, vcn_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[RouteTable]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[RouteTable]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[RouteTable]") def list_security_lists(self, compartment_id, vcn_id, **kwargs): """ @@ -4062,6 +4797,7 @@ def list_security_lists(self, compartment_id, vcn_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -4112,12 +4848,21 @@ def list_security_lists(self, compartment_id, vcn_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[SecurityList]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[SecurityList]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[SecurityList]") def list_subnets(self, compartment_id, vcn_id, **kwargs): """ @@ -4173,6 +4918,7 @@ def list_subnets(self, compartment_id, vcn_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -4223,12 +4969,21 @@ def list_subnets(self, compartment_id, vcn_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Subnet]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Subnet]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Subnet]") def list_vcns(self, compartment_id, **kwargs): """ @@ -4281,6 +5036,7 @@ def list_vcns(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -4330,12 +5086,21 @@ def list_vcns(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Vcn]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Vcn]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Vcn]") def list_virtual_circuit_bandwidth_shapes(self, compartment_id, **kwargs): """ @@ -4362,6 +5127,7 @@ def list_virtual_circuit_bandwidth_shapes(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -4382,12 +5148,21 @@ def list_virtual_circuit_bandwidth_shapes(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[VirtualCircuitBandwidthShape]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuitBandwidthShape]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuitBandwidthShape]") def list_virtual_circuit_public_prefixes(self, virtual_circuit_id, **kwargs): """ @@ -4413,6 +5188,7 @@ def list_virtual_circuit_public_prefixes(self, virtual_circuit_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "verification_state" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4447,13 +5223,23 @@ def list_virtual_circuit_public_prefixes(self, virtual_circuit_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[VirtualCircuitPublicPrefix]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuitPublicPrefix]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuitPublicPrefix]") def list_virtual_circuits(self, compartment_id, **kwargs): """ @@ -4506,6 +5292,7 @@ def list_virtual_circuits(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "display_name", @@ -4555,12 +5342,21 @@ def list_virtual_circuits(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[VirtualCircuit]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuit]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VirtualCircuit]") def update_cpe(self, cpe_id, update_cpe_details, **kwargs): """ @@ -4588,6 +5384,7 @@ def update_cpe(self, cpe_id, update_cpe_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4612,13 +5409,23 @@ def update_cpe(self, cpe_id, update_cpe_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_cpe_details, - response_type="Cpe") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_cpe_details, + response_type="Cpe") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_cpe_details, + response_type="Cpe") def update_cross_connect(self, cross_connect_id, update_cross_connect_details, **kwargs): """ @@ -4645,6 +5452,7 @@ def update_cross_connect(self, cross_connect_id, update_cross_connect_details, * # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4669,13 +5477,23 @@ def update_cross_connect(self, cross_connect_id, update_cross_connect_details, * } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_cross_connect_details, - response_type="CrossConnect") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_cross_connect_details, + response_type="CrossConnect") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_cross_connect_details, + response_type="CrossConnect") def update_cross_connect_group(self, cross_connect_group_id, update_cross_connect_group_details, **kwargs): """ @@ -4703,6 +5521,7 @@ def update_cross_connect_group(self, cross_connect_group_id, update_cross_connec # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4727,13 +5546,23 @@ def update_cross_connect_group(self, cross_connect_group_id, update_cross_connec } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_cross_connect_group_details, - response_type="CrossConnectGroup") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_cross_connect_group_details, + response_type="CrossConnectGroup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_cross_connect_group_details, + response_type="CrossConnectGroup") def update_dhcp_options(self, dhcp_id, update_dhcp_details, **kwargs): """ @@ -4763,6 +5592,7 @@ def update_dhcp_options(self, dhcp_id, update_dhcp_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4787,13 +5617,23 @@ def update_dhcp_options(self, dhcp_id, update_dhcp_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_dhcp_details, - response_type="DhcpOptions") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_dhcp_details, + response_type="DhcpOptions") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_dhcp_details, + response_type="DhcpOptions") def update_drg(self, drg_id, update_drg_details, **kwargs): """ @@ -4820,6 +5660,7 @@ def update_drg(self, drg_id, update_drg_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4844,13 +5685,23 @@ def update_drg(self, drg_id, update_drg_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_drg_details, - response_type="Drg") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_drg_details, + response_type="Drg") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_drg_details, + response_type="Drg") def update_drg_attachment(self, drg_attachment_id, update_drg_attachment_details, **kwargs): """ @@ -4878,6 +5729,7 @@ def update_drg_attachment(self, drg_attachment_id, update_drg_attachment_details # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4902,13 +5754,23 @@ def update_drg_attachment(self, drg_attachment_id, update_drg_attachment_details } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_drg_attachment_details, - response_type="DrgAttachment") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_drg_attachment_details, + response_type="DrgAttachment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_drg_attachment_details, + response_type="DrgAttachment") def update_internet_gateway(self, ig_id, update_internet_gateway_details, **kwargs): """ @@ -4939,6 +5801,7 @@ def update_internet_gateway(self, ig_id, update_internet_gateway_details, **kwar # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -4963,13 +5826,23 @@ def update_internet_gateway(self, ig_id, update_internet_gateway_details, **kwar } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_internet_gateway_details, - response_type="InternetGateway") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_internet_gateway_details, + response_type="InternetGateway") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_internet_gateway_details, + response_type="InternetGateway") def update_ip_sec_connection(self, ipsc_id, update_ip_sec_connection_details, **kwargs): """ @@ -4997,6 +5870,7 @@ def update_ip_sec_connection(self, ipsc_id, update_ip_sec_connection_details, ** # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5021,13 +5895,23 @@ def update_ip_sec_connection(self, ipsc_id, update_ip_sec_connection_details, ** } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_ip_sec_connection_details, - response_type="IPSecConnection") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_ip_sec_connection_details, + response_type="IPSecConnection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_ip_sec_connection_details, + response_type="IPSecConnection") def update_local_peering_gateway(self, local_peering_gateway_id, update_local_peering_gateway_details, **kwargs): """ @@ -5054,6 +5938,7 @@ def update_local_peering_gateway(self, local_peering_gateway_id, update_local_pe # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5078,13 +5963,23 @@ def update_local_peering_gateway(self, local_peering_gateway_id, update_local_pe } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_local_peering_gateway_details, - response_type="LocalPeeringGateway") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_local_peering_gateway_details, + response_type="LocalPeeringGateway") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_local_peering_gateway_details, + response_type="LocalPeeringGateway") def update_private_ip(self, private_ip_id, update_private_ip_details, **kwargs): """ @@ -5120,6 +6015,7 @@ def update_private_ip(self, private_ip_id, update_private_ip_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5144,13 +6040,23 @@ def update_private_ip(self, private_ip_id, update_private_ip_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_private_ip_details, - response_type="PrivateIp") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_private_ip_details, + response_type="PrivateIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_private_ip_details, + response_type="PrivateIp") def update_route_table(self, rt_id, update_route_table_details, **kwargs): """ @@ -5180,6 +6086,7 @@ def update_route_table(self, rt_id, update_route_table_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5204,13 +6111,23 @@ def update_route_table(self, rt_id, update_route_table_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_route_table_details, - response_type="RouteTable") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_route_table_details, + response_type="RouteTable") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_route_table_details, + response_type="RouteTable") def update_security_list(self, security_list_id, update_security_list_details, **kwargs): """ @@ -5241,6 +6158,7 @@ def update_security_list(self, security_list_id, update_security_list_details, * # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5265,13 +6183,23 @@ def update_security_list(self, security_list_id, update_security_list_details, * } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_security_list_details, - response_type="SecurityList") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_security_list_details, + response_type="SecurityList") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_security_list_details, + response_type="SecurityList") def update_subnet(self, subnet_id, update_subnet_details, **kwargs): """ @@ -5298,6 +6226,7 @@ def update_subnet(self, subnet_id, update_subnet_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5322,13 +6251,23 @@ def update_subnet(self, subnet_id, update_subnet_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_subnet_details, - response_type="Subnet") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_subnet_details, + response_type="Subnet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_subnet_details, + response_type="Subnet") def update_vcn(self, vcn_id, update_vcn_details, **kwargs): """ @@ -5356,6 +6295,7 @@ def update_vcn(self, vcn_id, update_vcn_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5380,13 +6320,23 @@ def update_vcn(self, vcn_id, update_vcn_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_vcn_details, - response_type="Vcn") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_vcn_details, + response_type="Vcn") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_vcn_details, + response_type="Vcn") def update_virtual_circuit(self, virtual_circuit_id, update_virtual_circuit_details, **kwargs): """ @@ -5438,6 +6388,7 @@ def update_virtual_circuit(self, virtual_circuit_id, update_virtual_circuit_deta # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5462,13 +6413,23 @@ def update_virtual_circuit(self, virtual_circuit_id, update_virtual_circuit_deta } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_virtual_circuit_details, - response_type="VirtualCircuit") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_virtual_circuit_details, + response_type="VirtualCircuit") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_virtual_circuit_details, + response_type="VirtualCircuit") def update_vnic(self, vnic_id, update_vnic_details, **kwargs): """ @@ -5495,6 +6456,7 @@ def update_vnic(self, vnic_id, update_vnic_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -5519,10 +6481,20 @@ def update_vnic(self, vnic_id, update_vnic_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_vnic_details, - response_type="Vnic") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_vnic_details, + response_type="Vnic") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_vnic_details, + response_type="Vnic") diff --git a/src/oci/database/database_client.py b/src/oci/database/database_client.py index 4b45d0d651..e45b2a3903 100644 --- a/src/oci/database/database_client.py +++ b/src/oci/database/database_client.py @@ -3,8 +3,10 @@ from __future__ import absolute_import +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -15,16 +17,19 @@ class DatabaseClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("database", config, signer, database_type_mapping) def create_backup(self, create_backup_details, **kwargs): @@ -51,6 +56,7 @@ def create_backup(self, create_backup_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -65,12 +71,23 @@ def create_backup(self, create_backup_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_backup_details, - response_type="Backup") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_backup_details, + response_type="Backup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_backup_details, + response_type="Backup") def create_data_guard_association(self, database_id, create_data_guard_association_details, **kwargs): """ @@ -111,6 +128,7 @@ def create_data_guard_association(self, database_id, create_data_guard_associati # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -135,13 +153,25 @@ def create_data_guard_association(self, database_id, create_data_guard_associati } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_data_guard_association_details, - response_type="DataGuardAssociation") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_data_guard_association_details, + response_type="DataGuardAssociation") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_data_guard_association_details, + response_type="DataGuardAssociation") def create_db_home(self, create_db_home_with_db_system_id_details, **kwargs): """ @@ -167,6 +197,7 @@ def create_db_home(self, create_db_home_with_db_system_id_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -181,12 +212,23 @@ def create_db_home(self, create_db_home_with_db_system_id_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_db_home_with_db_system_id_details, - response_type="DbHome") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_db_home_with_db_system_id_details, + response_type="DbHome") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_db_home_with_db_system_id_details, + response_type="DbHome") def db_node_action(self, db_node_id, action, **kwargs): """ @@ -238,6 +280,7 @@ def db_node_action(self, db_node_id, action, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token", "if_match" ] @@ -269,13 +312,25 @@ def db_node_action(self, db_node_id, action, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="DbNode") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="DbNode") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="DbNode") def delete_backup(self, backup_id, **kwargs): """ @@ -299,6 +354,7 @@ def delete_backup(self, backup_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -323,11 +379,19 @@ def delete_backup(self, backup_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_db_home(self, db_home_id, **kwargs): """ @@ -356,6 +420,7 @@ def delete_db_home(self, db_home_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "perform_final_backup" ] @@ -386,12 +451,21 @@ def delete_db_home(self, db_home_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) def failover_data_guard_association(self, database_id, data_guard_association_id, failover_data_guard_association_details, **kwargs): """ @@ -429,6 +503,7 @@ def failover_data_guard_association(self, database_id, data_guard_association_id # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -454,13 +529,23 @@ def failover_data_guard_association(self, database_id, data_guard_association_id } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=failover_data_guard_association_details, - response_type="DataGuardAssociation") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=failover_data_guard_association_details, + response_type="DataGuardAssociation") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=failover_data_guard_association_details, + response_type="DataGuardAssociation") def get_backup(self, backup_id, **kwargs): """ @@ -477,9 +562,11 @@ def get_backup(self, backup_id, **kwargs): resource_path = "/backups/{backupId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_backup got unknown kwargs: {!r}".format(kwargs)) + "get_backup got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "backupId": backup_id @@ -496,12 +583,21 @@ def get_backup(self, backup_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Backup") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Backup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Backup") def get_data_guard_association(self, database_id, data_guard_association_id, **kwargs): """ @@ -525,9 +621,11 @@ def get_data_guard_association(self, database_id, data_guard_association_id, **k resource_path = "/databases/{databaseId}/dataGuardAssociations/{dataGuardAssociationId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_data_guard_association got unknown kwargs: {!r}".format(kwargs)) + "get_data_guard_association got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "databaseId": database_id, @@ -545,12 +643,21 @@ def get_data_guard_association(self, database_id, data_guard_association_id, **k "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="DataGuardAssociation") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DataGuardAssociation") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DataGuardAssociation") def get_database(self, database_id, **kwargs): """ @@ -569,9 +676,11 @@ def get_database(self, database_id, **kwargs): resource_path = "/databases/{databaseId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_database got unknown kwargs: {!r}".format(kwargs)) + "get_database got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "databaseId": database_id @@ -588,12 +697,21 @@ def get_database(self, database_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Database") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Database") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Database") def get_db_home(self, db_home_id, **kwargs): """ @@ -612,9 +730,11 @@ def get_db_home(self, db_home_id, **kwargs): resource_path = "/dbHomes/{dbHomeId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_db_home got unknown kwargs: {!r}".format(kwargs)) + "get_db_home got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dbHomeId": db_home_id @@ -631,12 +751,21 @@ def get_db_home(self, db_home_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="DbHome") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DbHome") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DbHome") def get_db_home_patch(self, db_home_id, patch_id, **kwargs): """ @@ -658,9 +787,11 @@ def get_db_home_patch(self, db_home_id, patch_id, **kwargs): resource_path = "/dbHomes/{dbHomeId}/patches/{patchId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_db_home_patch got unknown kwargs: {!r}".format(kwargs)) + "get_db_home_patch got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dbHomeId": db_home_id, @@ -678,12 +809,21 @@ def get_db_home_patch(self, db_home_id, patch_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Patch") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Patch") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Patch") def get_db_home_patch_history_entry(self, db_home_id, patch_history_entry_id, **kwargs): """ @@ -705,9 +845,11 @@ def get_db_home_patch_history_entry(self, db_home_id, patch_history_entry_id, ** resource_path = "/dbHomes/{dbHomeId}/patchHistoryEntries/{patchHistoryEntryId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_db_home_patch_history_entry got unknown kwargs: {!r}".format(kwargs)) + "get_db_home_patch_history_entry got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dbHomeId": db_home_id, @@ -725,12 +867,21 @@ def get_db_home_patch_history_entry(self, db_home_id, patch_history_entry_id, ** "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="PatchHistoryEntry") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PatchHistoryEntry") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PatchHistoryEntry") def get_db_node(self, db_node_id, **kwargs): """ @@ -749,9 +900,11 @@ def get_db_node(self, db_node_id, **kwargs): resource_path = "/dbNodes/{dbNodeId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_db_node got unknown kwargs: {!r}".format(kwargs)) + "get_db_node got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dbNodeId": db_node_id @@ -768,12 +921,21 @@ def get_db_node(self, db_node_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="DbNode") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DbNode") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DbNode") def get_db_system(self, db_system_id, **kwargs): """ @@ -792,9 +954,11 @@ def get_db_system(self, db_system_id, **kwargs): resource_path = "/dbSystems/{dbSystemId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_db_system got unknown kwargs: {!r}".format(kwargs)) + "get_db_system got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dbSystemId": db_system_id @@ -811,12 +975,21 @@ def get_db_system(self, db_system_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="DbSystem") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DbSystem") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DbSystem") def get_db_system_patch(self, db_system_id, patch_id, **kwargs): """ @@ -838,9 +1011,11 @@ def get_db_system_patch(self, db_system_id, patch_id, **kwargs): resource_path = "/dbSystems/{dbSystemId}/patches/{patchId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_db_system_patch got unknown kwargs: {!r}".format(kwargs)) + "get_db_system_patch got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dbSystemId": db_system_id, @@ -858,12 +1033,21 @@ def get_db_system_patch(self, db_system_id, patch_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Patch") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Patch") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Patch") def get_db_system_patch_history_entry(self, db_system_id, patch_history_entry_id, **kwargs): """ @@ -885,9 +1069,11 @@ def get_db_system_patch_history_entry(self, db_system_id, patch_history_entry_id resource_path = "/dbSystems/{dbSystemId}/patchHistoryEntries/{patchHistoryEntryId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_db_system_patch_history_entry got unknown kwargs: {!r}".format(kwargs)) + "get_db_system_patch_history_entry got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "dbSystemId": db_system_id, @@ -905,12 +1091,21 @@ def get_db_system_patch_history_entry(self, db_system_id, patch_history_entry_id "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="PatchHistoryEntry") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PatchHistoryEntry") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PatchHistoryEntry") def launch_db_system(self, launch_db_system_details, **kwargs): """ @@ -948,6 +1143,7 @@ def launch_db_system(self, launch_db_system_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -962,12 +1158,23 @@ def launch_db_system(self, launch_db_system_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=launch_db_system_details, - response_type="DbSystem") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=launch_db_system_details, + response_type="DbSystem") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=launch_db_system_details, + response_type="DbSystem") def list_backups(self, **kwargs): """ @@ -995,6 +1202,7 @@ def list_backups(self, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "database_id", "compartment_id", "limit", @@ -1018,12 +1226,21 @@ def list_backups(self, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[BackupSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[BackupSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[BackupSummary]") def list_data_guard_associations(self, database_id, **kwargs): """ @@ -1050,6 +1267,7 @@ def list_data_guard_associations(self, database_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1079,13 +1297,23 @@ def list_data_guard_associations(self, database_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[DataGuardAssociationSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[DataGuardAssociationSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[DataGuardAssociationSummary]") def list_databases(self, compartment_id, db_home_id, **kwargs): """ @@ -1117,6 +1345,7 @@ def list_databases(self, compartment_id, db_home_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1138,12 +1367,21 @@ def list_databases(self, compartment_id, db_home_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DatabaseSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DatabaseSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DatabaseSummary]") def list_db_home_patch_history_entries(self, db_home_id, **kwargs): """ @@ -1170,6 +1408,7 @@ def list_db_home_patch_history_entries(self, db_home_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1199,13 +1438,23 @@ def list_db_home_patch_history_entries(self, db_home_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[PatchHistoryEntrySummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchHistoryEntrySummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchHistoryEntrySummary]") def list_db_home_patches(self, db_home_id, **kwargs): """ @@ -1232,6 +1481,7 @@ def list_db_home_patches(self, db_home_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1261,13 +1511,23 @@ def list_db_home_patches(self, db_home_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[PatchSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchSummary]") def list_db_homes(self, compartment_id, db_system_id, **kwargs): """ @@ -1299,6 +1559,7 @@ def list_db_homes(self, compartment_id, db_system_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1320,12 +1581,21 @@ def list_db_homes(self, compartment_id, db_system_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DbHomeSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbHomeSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbHomeSummary]") def list_db_nodes(self, compartment_id, db_system_id, **kwargs): """ @@ -1357,6 +1627,7 @@ def list_db_nodes(self, compartment_id, db_system_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1378,12 +1649,21 @@ def list_db_nodes(self, compartment_id, db_system_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DbNodeSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbNodeSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbNodeSummary]") def list_db_system_patch_history_entries(self, db_system_id, **kwargs): """ @@ -1410,6 +1690,7 @@ def list_db_system_patch_history_entries(self, db_system_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1439,13 +1720,23 @@ def list_db_system_patch_history_entries(self, db_system_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[PatchHistoryEntrySummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchHistoryEntrySummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchHistoryEntrySummary]") def list_db_system_patches(self, db_system_id, **kwargs): """ @@ -1472,6 +1763,7 @@ def list_db_system_patches(self, db_system_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1501,13 +1793,23 @@ def list_db_system_patches(self, db_system_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[PatchSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PatchSummary]") def list_db_system_shapes(self, availability_domain, compartment_id, **kwargs): """ @@ -1537,6 +1839,7 @@ def list_db_system_shapes(self, availability_domain, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1558,12 +1861,21 @@ def list_db_system_shapes(self, availability_domain, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DbSystemShapeSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbSystemShapeSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbSystemShapeSummary]") def list_db_systems(self, compartment_id, **kwargs): """ @@ -1590,6 +1902,7 @@ def list_db_systems(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page" ] @@ -1610,12 +1923,21 @@ def list_db_systems(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DbSystemSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbSystemSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbSystemSummary]") def list_db_versions(self, compartment_id, **kwargs): """ @@ -1645,6 +1967,7 @@ def list_db_versions(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "db_system_shape" @@ -1667,12 +1990,21 @@ def list_db_versions(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[DbVersionSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbVersionSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DbVersionSummary]") def reinstate_data_guard_association(self, database_id, data_guard_association_id, reinstate_data_guard_association_details, **kwargs): """ @@ -1706,6 +2038,7 @@ def reinstate_data_guard_association(self, database_id, data_guard_association_i # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1731,13 +2064,23 @@ def reinstate_data_guard_association(self, database_id, data_guard_association_i } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=reinstate_data_guard_association_details, - response_type="DataGuardAssociation") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=reinstate_data_guard_association_details, + response_type="DataGuardAssociation") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=reinstate_data_guard_association_details, + response_type="DataGuardAssociation") def restore_database(self, database_id, restore_database_details, **kwargs): """ @@ -1766,6 +2109,7 @@ def restore_database(self, database_id, restore_database_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1790,13 +2134,23 @@ def restore_database(self, database_id, restore_database_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=restore_database_details, - response_type="Database") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=restore_database_details, + response_type="Database") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=restore_database_details, + response_type="Database") def switchover_data_guard_association(self, database_id, data_guard_association_id, switchover_data_guard_association_details, **kwargs): """ @@ -1833,6 +2187,7 @@ def switchover_data_guard_association(self, database_id, data_guard_association_ # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1858,13 +2213,23 @@ def switchover_data_guard_association(self, database_id, data_guard_association_ } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=switchover_data_guard_association_details, - response_type="DataGuardAssociation") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=switchover_data_guard_association_details, + response_type="DataGuardAssociation") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=switchover_data_guard_association_details, + response_type="DataGuardAssociation") def terminate_db_system(self, db_system_id, **kwargs): """ @@ -1890,6 +2255,7 @@ def terminate_db_system(self, db_system_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1914,11 +2280,19 @@ def terminate_db_system(self, db_system_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def update_database(self, database_id, update_database_details, **kwargs): """ @@ -1947,6 +2321,7 @@ def update_database(self, database_id, update_database_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1971,13 +2346,23 @@ def update_database(self, database_id, update_database_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_database_details, - response_type="Database") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_database_details, + response_type="Database") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_database_details, + response_type="Database") def update_db_home(self, db_home_id, update_db_home_details, **kwargs): """ @@ -2006,6 +2391,7 @@ def update_db_home(self, db_home_id, update_db_home_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2030,13 +2416,23 @@ def update_db_home(self, db_home_id, update_db_home_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_db_home_details, - response_type="DbHome") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_db_home_details, + response_type="DbHome") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_db_home_details, + response_type="DbHome") def update_db_system(self, db_system_id, update_db_system_details, **kwargs): """ @@ -2065,6 +2461,7 @@ def update_db_system(self, db_system_id, update_db_system_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2089,10 +2486,20 @@ def update_db_system(self, db_system_id, update_db_system_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_db_system_details, - response_type="DbSystem") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_db_system_details, + response_type="DbSystem") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_db_system_details, + response_type="DbSystem") diff --git a/src/oci/identity/identity_client.py b/src/oci/identity/identity_client.py index 6d8e7f71dc..ca3c1b265c 100644 --- a/src/oci/identity/identity_client.py +++ b/src/oci/identity/identity_client.py @@ -3,8 +3,10 @@ from __future__ import absolute_import +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -15,16 +17,19 @@ class IdentityClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("identity", config, signer, identity_type_mapping) def add_user_to_group(self, add_user_to_group_details, **kwargs): @@ -54,6 +59,7 @@ def add_user_to_group(self, add_user_to_group_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -68,12 +74,23 @@ def add_user_to_group(self, add_user_to_group_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=add_user_to_group_details, - response_type="UserGroupMembership") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=add_user_to_group_details, + response_type="UserGroupMembership") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=add_user_to_group_details, + response_type="UserGroupMembership") def create_compartment(self, create_compartment_details, **kwargs): """ @@ -120,6 +137,7 @@ def create_compartment(self, create_compartment_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -134,12 +152,23 @@ def create_compartment(self, create_compartment_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_compartment_details, - response_type="Compartment") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_compartment_details, + response_type="Compartment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_compartment_details, + response_type="Compartment") def create_customer_secret_key(self, create_customer_secret_key_details, user_id, **kwargs): """ @@ -180,6 +209,7 @@ def create_customer_secret_key(self, create_customer_secret_key_details, user_id # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -204,13 +234,102 @@ def create_customer_secret_key(self, create_customer_secret_key_details, user_id } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_customer_secret_key_details, - response_type="CustomerSecretKey") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_customer_secret_key_details, + response_type="CustomerSecretKey") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_customer_secret_key_details, + response_type="CustomerSecretKey") + + def create_dynamic_group(self, create_dynamic_group_details, **kwargs): + """ + CreateDynamicGroup + Creates a new dynamic group in your tenancy. + + You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy + is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies) + reside within the tenancy itself, unlike cloud resources such as compute instances, which typically + reside within compartments inside the tenancy. For information about OCIDs, see + `Resource Identifiers`__. + + You must also specify a *name* for the dynamic group, which must be unique across all dynamic groups in your + tenancy, and cannot be changed. Note that this name has to be also unique accross all groups in your tenancy. + You can use this name or the OCID when writing policies that apply to the dynamic group. For more information + about policies, see `How Policies Work`__. + + You must also specify a *description* for the dynamic group (although it can be an empty string). It does not + have to be unique, and you can change it anytime with :func:`update_dynamic_group`. + + After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the + object, first make sure its `lifecycleState` has changed to ACTIVE. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policies.htm + + + :param CreateDynamicGroupDetails create_dynamic_group_details: (required) + Request object for creating a new dynamic group. + + :param str opc_retry_token: (optional) + A token that uniquely identifies a request so it can be retried in case of a timeout or + server error without risk of executing that same action again. Retry tokens expire after 24 + hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + has been deleted and purged from the system, then a retry of the original creation request + may be rejected). + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.identity.models.DynamicGroup` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/dynamicGroups/" + method = "POST" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_retry_token" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_dynamic_group got unknown kwargs: {!r}".format(extra_kwargs)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-retry-token": kwargs.get("opc_retry_token", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_dynamic_group_details, + response_type="DynamicGroup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_dynamic_group_details, + response_type="DynamicGroup") def create_group(self, create_group_details, **kwargs): """ @@ -259,6 +378,7 @@ def create_group(self, create_group_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -273,12 +393,23 @@ def create_group(self, create_group_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_group_details, - response_type="Group") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_group_details, + response_type="Group") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_group_details, + response_type="Group") def create_identity_provider(self, create_identity_provider_details, **kwargs): """ @@ -324,6 +455,7 @@ def create_identity_provider(self, create_identity_provider_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -338,12 +470,23 @@ def create_identity_provider(self, create_identity_provider_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_identity_provider_details, - response_type="IdentityProvider") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_identity_provider_details, + response_type="IdentityProvider") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_identity_provider_details, + response_type="IdentityProvider") def create_idp_group_mapping(self, create_idp_group_mapping_details, identity_provider_id, **kwargs): """ @@ -373,6 +516,7 @@ def create_idp_group_mapping(self, create_idp_group_mapping_details, identity_pr # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -397,13 +541,25 @@ def create_idp_group_mapping(self, create_idp_group_mapping_details, identity_pr } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_idp_group_mapping_details, - response_type="IdpGroupMapping") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_idp_group_mapping_details, + response_type="IdpGroupMapping") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_idp_group_mapping_details, + response_type="IdpGroupMapping") def create_or_reset_ui_password(self, user_id, **kwargs): """ @@ -441,6 +597,7 @@ def create_or_reset_ui_password(self, user_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -465,12 +622,23 @@ def create_or_reset_ui_password(self, user_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="UIPassword") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="UIPassword") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="UIPassword") def create_policy(self, create_policy_details, **kwargs): """ @@ -516,6 +684,7 @@ def create_policy(self, create_policy_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -530,12 +699,23 @@ def create_policy(self, create_policy_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_policy_details, - response_type="Policy") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_policy_details, + response_type="Policy") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_policy_details, + response_type="Policy") def create_region_subscription(self, create_region_subscription_details, tenancy_id, **kwargs): """ @@ -564,6 +744,7 @@ def create_region_subscription(self, create_region_subscription_details, tenancy # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -588,13 +769,25 @@ def create_region_subscription(self, create_region_subscription_details, tenancy } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_region_subscription_details, - response_type="RegionSubscription") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_region_subscription_details, + response_type="RegionSubscription") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_region_subscription_details, + response_type="RegionSubscription") def create_swift_password(self, create_swift_password_details, user_id, **kwargs): """ @@ -634,6 +827,7 @@ def create_swift_password(self, create_swift_password_details, user_id, **kwargs # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -658,37 +852,48 @@ def create_swift_password(self, create_swift_password_details, user_id, **kwargs } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_swift_password_details, - response_type="SwiftPassword") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_swift_password_details, + response_type="SwiftPassword") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_swift_password_details, + response_type="SwiftPassword") def create_tag(self, tag_namespace_id, create_tag_details, **kwargs): """ CreateTag - Creates a new tag in a given tagNamespace. + Creates a new tag in the specified tag namespace. - You have to specify either the id or the name of the tagNamespace that will contain this tag definition. + You must specify either the OCID or the name of the tag namespace that will contain this tag definition. - You must also specify a *name* for the tag, which must be unique across all tags in the tagNamespace - and cannot be changed. All ascii characters are allowed except spaces and dots. Note that names are case - insenstive, that means you can not have two different tags with same name but with different casing in - one tagNamespace. - If you specify a name that's already in use in the tagNamespace, you'll get a 409 error. + You must also specify a *name* for the tag, which must be unique across all tags in the tag namespace + and cannot be changed. The name can contain any ASCII character except the space (_) or period (.) characters. + Names are case insensitive. That means, for example, \"myTag\" and \"mytag\" are not allowed in the same namespace. + If you specify a name that's already in use in the tag namespace, a 409 error is returned. You must also specify a *description* for the tag. - It does not have to be unique, and you can change it anytime with + It does not have to be unique, and you can change it with :func:`update_tag`. :param str tag_namespace_id: (required) - The OCID of the tagNamespace + The OCID of the tag namespace. :param CreateTagDetails create_tag_details: (required) - Request object for creating a new tag in a given tagNamespace. + Request object for creating a new tag in the specified tag namespace. :param str opc_retry_token: (optional) A token that uniquely identifies a request so it can be retried in case of a timeout or @@ -705,6 +910,7 @@ def create_tag(self, tag_namespace_id, create_tag_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -729,36 +935,52 @@ def create_tag(self, tag_namespace_id, create_tag_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_tag_details, - response_type="Tag") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_tag_details, + response_type="Tag") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_tag_details, + response_type="Tag") def create_tag_namespace(self, create_tag_namespace_details, **kwargs): """ CreateTagNamespace - Creates a new tagNamespace in a given compartment. + Creates a new tag namespace in the specified compartment. You must specify the compartment ID in the request object (remember that the tenancy is simply the root compartment). You must also specify a *name* for the namespace, which must be unique across all namespaces in your tenancy - and cannot be changed. All ascii characters are allowed except spaces and dots. - Note that names are case insenstive, that means you can not have two different namespaces with same name - but with different casing in one tenancy. - Once you created a namespace, you can not change the name - If you specify a name that's already in use in the tennacy, you'll get a 409 error. + and cannot be changed. The name can contain any ASCII character except the space (_) or period (.). + Names are case insensitive. That means, for example, \"myNamespace\" and \"mynamespace\" are not allowed + in the same tenancy. Once you created a namespace, you cannot change the name. + If you specify a name that's already in use in the tenancy, a 409 error is returned. You must also specify a *description* for the namespace. - It does not have to be unique, and you can change it anytime with + It does not have to be unique, and you can change it with :func:`update_tag_namespace`. + Tag namespaces cannot be deleted, but they can be retired. + See `Retiring Key Definitions and Namespace Definitions`__ for more information. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring + :param CreateTagNamespaceDetails create_tag_namespace_details: (required) - Request object for creating a new tagNamespace. + Request object for creating a new tag namespace. :param str opc_retry_token: (optional) A token that uniquely identifies a request so it can be retried in case of a timeout or @@ -775,6 +997,7 @@ def create_tag_namespace(self, create_tag_namespace_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -789,12 +1012,23 @@ def create_tag_namespace(self, create_tag_namespace_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_tag_namespace_details, - response_type="TagNamespace") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_tag_namespace_details, + response_type="TagNamespace") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_tag_namespace_details, + response_type="TagNamespace") def create_user(self, create_user_details, **kwargs): """ @@ -858,6 +1092,7 @@ def create_user(self, create_user_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -872,12 +1107,23 @@ def create_user(self, create_user_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_user_details, - response_type="User") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_user_details, + response_type="User") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_user_details, + response_type="User") def delete_api_key(self, user_id, fingerprint, **kwargs): """ @@ -909,6 +1155,7 @@ def delete_api_key(self, user_id, fingerprint, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -934,11 +1181,19 @@ def delete_api_key(self, user_id, fingerprint, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_customer_secret_key(self, user_id, customer_secret_key_id, **kwargs): """ @@ -965,6 +1220,7 @@ def delete_customer_secret_key(self, user_id, customer_secret_key_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -990,11 +1246,80 @@ def delete_customer_secret_key(self, user_id, customer_secret_key_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + + def delete_dynamic_group(self, dynamic_group_id, **kwargs): + """ + DeleteDynamicGroup + Deletes the specified dynamic group. + + + :param str dynamic_group_id: (required) + The OCID of the dynamic group. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + parameter to the value of the etag from a previous GET or POST response for that resource. The resource + will be updated or deleted only if the etag you provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/dynamicGroups/{dynamicGroupId}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_dynamic_group got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "dynamicGroupId": dynamic_group_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_group(self, group_id, **kwargs): """ @@ -1018,6 +1343,7 @@ def delete_group(self, group_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1042,11 +1368,19 @@ def delete_group(self, group_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_identity_provider(self, identity_provider_id, **kwargs): """ @@ -1071,6 +1405,7 @@ def delete_identity_provider(self, identity_provider_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1095,11 +1430,19 @@ def delete_identity_provider(self, identity_provider_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_idp_group_mapping(self, identity_provider_id, mapping_id, **kwargs): """ @@ -1126,6 +1469,7 @@ def delete_idp_group_mapping(self, identity_provider_id, mapping_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1151,11 +1495,19 @@ def delete_idp_group_mapping(self, identity_provider_id, mapping_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_policy(self, policy_id, **kwargs): """ @@ -1179,6 +1531,7 @@ def delete_policy(self, policy_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1203,11 +1556,19 @@ def delete_policy(self, policy_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_swift_password(self, user_id, swift_password_id, **kwargs): """ @@ -1234,6 +1595,7 @@ def delete_swift_password(self, user_id, swift_password_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1259,11 +1621,19 @@ def delete_swift_password(self, user_id, swift_password_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_user(self, user_id, **kwargs): """ @@ -1287,6 +1657,7 @@ def delete_user(self, user_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1311,11 +1682,19 @@ def delete_user(self, user_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def get_compartment(self, compartment_id, **kwargs): """ @@ -1339,9 +1718,11 @@ def get_compartment(self, compartment_id, **kwargs): resource_path = "/compartments/{compartmentId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_compartment got unknown kwargs: {!r}".format(kwargs)) + "get_compartment got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "compartmentId": compartment_id @@ -1358,12 +1739,73 @@ def get_compartment(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Compartment") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Compartment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Compartment") + + def get_dynamic_group(self, dynamic_group_id, **kwargs): + """ + GetDynamicGroup + Gets the specified dynamic group's information. + + + :param str dynamic_group_id: (required) + The OCID of the dynamic group. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.identity.models.DynamicGroup` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/dynamicGroups/{dynamicGroupId}" + method = "GET" + + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_dynamic_group got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "dynamicGroupId": dynamic_group_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DynamicGroup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DynamicGroup") def get_group(self, group_id, **kwargs): """ @@ -1384,9 +1826,11 @@ def get_group(self, group_id, **kwargs): resource_path = "/groups/{groupId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_group got unknown kwargs: {!r}".format(kwargs)) + "get_group got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "groupId": group_id @@ -1403,12 +1847,21 @@ def get_group(self, group_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Group") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Group") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Group") def get_identity_provider(self, identity_provider_id, **kwargs): """ @@ -1425,9 +1878,11 @@ def get_identity_provider(self, identity_provider_id, **kwargs): resource_path = "/identityProviders/{identityProviderId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_identity_provider got unknown kwargs: {!r}".format(kwargs)) + "get_identity_provider got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "identityProviderId": identity_provider_id @@ -1444,12 +1899,21 @@ def get_identity_provider(self, identity_provider_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="IdentityProvider") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IdentityProvider") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IdentityProvider") def get_idp_group_mapping(self, identity_provider_id, mapping_id, **kwargs): """ @@ -1469,9 +1933,11 @@ def get_idp_group_mapping(self, identity_provider_id, mapping_id, **kwargs): resource_path = "/identityProviders/{identityProviderId}/groupMappings/{mappingId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_idp_group_mapping got unknown kwargs: {!r}".format(kwargs)) + "get_idp_group_mapping got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "identityProviderId": identity_provider_id, @@ -1489,12 +1955,21 @@ def get_idp_group_mapping(self, identity_provider_id, mapping_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="IdpGroupMapping") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IdpGroupMapping") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="IdpGroupMapping") def get_policy(self, policy_id, **kwargs): """ @@ -1511,9 +1986,11 @@ def get_policy(self, policy_id, **kwargs): resource_path = "/policies/{policyId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_policy got unknown kwargs: {!r}".format(kwargs)) + "get_policy got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "policyId": policy_id @@ -1530,12 +2007,21 @@ def get_policy(self, policy_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Policy") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Policy") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Policy") def get_tag(self, tag_namespace_id, tag_name, **kwargs): """ @@ -1544,10 +2030,10 @@ def get_tag(self, tag_namespace_id, tag_name, **kwargs): :param str tag_namespace_id: (required) - The OCID of the tagNamespace + The OCID of the tag namespace. :param str tag_name: (required) - The name of the tag + The name of the tag. :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.identity.models.Tag` :rtype: :class:`~oci.response.Response` @@ -1555,9 +2041,11 @@ def get_tag(self, tag_namespace_id, tag_name, **kwargs): resource_path = "/tagNamespaces/{tagNamespaceId}/tags/{tagName}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_tag got unknown kwargs: {!r}".format(kwargs)) + "get_tag got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "tagNamespaceId": tag_namespace_id, @@ -1575,21 +2063,30 @@ def get_tag(self, tag_namespace_id, tag_name, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Tag") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Tag") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Tag") def get_tag_namespace(self, tag_namespace_id, **kwargs): """ GetTagNamespace - Gets the specified tagNamespace's information. + Gets the specified tag namespace's information. :param str tag_namespace_id: (required) - The OCID of the tagNamespace + The OCID of the tag namespace. :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.identity.models.TagNamespace` :rtype: :class:`~oci.response.Response` @@ -1597,9 +2094,11 @@ def get_tag_namespace(self, tag_namespace_id, **kwargs): resource_path = "/tagNamespaces/{tagNamespaceId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_tag_namespace got unknown kwargs: {!r}".format(kwargs)) + "get_tag_namespace got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "tagNamespaceId": tag_namespace_id @@ -1616,12 +2115,21 @@ def get_tag_namespace(self, tag_namespace_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="TagNamespace") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="TagNamespace") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="TagNamespace") def get_tenancy(self, tenancy_id, **kwargs): """ @@ -1638,9 +2146,11 @@ def get_tenancy(self, tenancy_id, **kwargs): resource_path = "/tenancies/{tenancyId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_tenancy got unknown kwargs: {!r}".format(kwargs)) + "get_tenancy got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "tenancyId": tenancy_id @@ -1657,12 +2167,21 @@ def get_tenancy(self, tenancy_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Tenancy") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Tenancy") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Tenancy") def get_user(self, user_id, **kwargs): """ @@ -1679,9 +2198,11 @@ def get_user(self, user_id, **kwargs): resource_path = "/users/{userId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_user got unknown kwargs: {!r}".format(kwargs)) + "get_user got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "userId": user_id @@ -1698,12 +2219,21 @@ def get_user(self, user_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="User") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="User") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="User") def get_user_group_membership(self, user_group_membership_id, **kwargs): """ @@ -1720,9 +2250,11 @@ def get_user_group_membership(self, user_group_membership_id, **kwargs): resource_path = "/userGroupMemberships/{userGroupMembershipId}" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "get_user_group_membership got unknown kwargs: {!r}".format(kwargs)) + "get_user_group_membership got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "userGroupMembershipId": user_group_membership_id @@ -1739,12 +2271,21 @@ def get_user_group_membership(self, user_group_membership_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="UserGroupMembership") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="UserGroupMembership") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="UserGroupMembership") def list_api_keys(self, user_id, **kwargs): """ @@ -1764,9 +2305,11 @@ def list_api_keys(self, user_id, **kwargs): resource_path = "/users/{userId}/apiKeys/" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "list_api_keys got unknown kwargs: {!r}".format(kwargs)) + "list_api_keys got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "userId": user_id @@ -1783,12 +2326,21 @@ def list_api_keys(self, user_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="list[ApiKey]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[ApiKey]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[ApiKey]") def list_availability_domains(self, compartment_id, **kwargs): """ @@ -1809,9 +2361,11 @@ def list_availability_domains(self, compartment_id, **kwargs): resource_path = "/availabilityDomains/" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "list_availability_domains got unknown kwargs: {!r}".format(kwargs)) + "list_availability_domains got unknown kwargs: {!r}".format(extra_kwargs)) query_params = { "compartmentId": compartment_id @@ -1823,12 +2377,21 @@ def list_availability_domains(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[AvailabilityDomain]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[AvailabilityDomain]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[AvailabilityDomain]") def list_compartments(self, compartment_id, **kwargs): """ @@ -1857,6 +2420,7 @@ def list_compartments(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit" ] @@ -1877,12 +2441,21 @@ def list_compartments(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Compartment]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Compartment]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Compartment]") def list_customer_secret_keys(self, user_id, **kwargs): """ @@ -1900,9 +2473,11 @@ def list_customer_secret_keys(self, user_id, **kwargs): resource_path = "/users/{userId}/customerSecretKeys/" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "list_customer_secret_keys got unknown kwargs: {!r}".format(kwargs)) + "list_customer_secret_keys got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "userId": user_id @@ -1919,12 +2494,85 @@ def list_customer_secret_keys(self, user_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="list[CustomerSecretKeySummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[CustomerSecretKeySummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[CustomerSecretKeySummary]") + + def list_dynamic_groups(self, compartment_id, **kwargs): + """ + ListDynamicGroups + Lists the dynamic groups in your tenancy. You must specify your tenancy's OCID as the value for + the compartment ID (remember that the tenancy is simply the root compartment). + See `Where to Get the Tenancy's OCID and User's OCID`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five + + + :param str compartment_id: (required) + The OCID of the compartment (remember that the tenancy is simply the root compartment). + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param int limit: (optional) + The maximum number of items to return in a paginated \"List\" call. + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.identity.models.DynamicGroup` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/dynamicGroups/" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "page", + "limit" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_dynamic_groups got unknown kwargs: {!r}".format(extra_kwargs)) + + query_params = { + "compartmentId": compartment_id, + "page": kwargs.get("page", missing), + "limit": kwargs.get("limit", missing) + } + query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DynamicGroup]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[DynamicGroup]") def list_groups(self, compartment_id, **kwargs): """ @@ -1953,6 +2601,7 @@ def list_groups(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit" ] @@ -1973,12 +2622,21 @@ def list_groups(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Group]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Group]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Group]") def list_identity_providers(self, protocol, compartment_id, **kwargs): """ @@ -2013,6 +2671,7 @@ def list_identity_providers(self, protocol, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit" ] @@ -2034,12 +2693,21 @@ def list_identity_providers(self, protocol, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[IdentityProvider]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[IdentityProvider]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[IdentityProvider]") def list_idp_group_mappings(self, identity_provider_id, **kwargs): """ @@ -2064,6 +2732,7 @@ def list_idp_group_mappings(self, identity_provider_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit" ] @@ -2093,13 +2762,23 @@ def list_idp_group_mappings(self, identity_provider_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[IdpGroupMapping]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[IdpGroupMapping]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[IdpGroupMapping]") def list_policies(self, compartment_id, **kwargs): """ @@ -2130,6 +2809,7 @@ def list_policies(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit" ] @@ -2150,12 +2830,21 @@ def list_policies(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[Policy]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Policy]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[Policy]") def list_region_subscriptions(self, tenancy_id, **kwargs): """ @@ -2172,9 +2861,11 @@ def list_region_subscriptions(self, tenancy_id, **kwargs): resource_path = "/tenancies/{tenancyId}/regionSubscriptions" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "list_region_subscriptions got unknown kwargs: {!r}".format(kwargs)) + "list_region_subscriptions got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "tenancyId": tenancy_id @@ -2191,12 +2882,21 @@ def list_region_subscriptions(self, tenancy_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="list[RegionSubscription]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[RegionSubscription]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[RegionSubscription]") def list_regions(self, **kwargs): """ @@ -2210,20 +2910,30 @@ def list_regions(self, **kwargs): resource_path = "/regions" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "list_regions got unknown kwargs: {!r}".format(kwargs)) + "list_regions got unknown kwargs: {!r}".format(extra_kwargs)) header_params = { "accept": "application/json", "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - response_type="list[Region]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + response_type="list[Region]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + response_type="list[Region]") def list_swift_passwords(self, user_id, **kwargs): """ @@ -2241,9 +2951,11 @@ def list_swift_passwords(self, user_id, **kwargs): resource_path = "/users/{userId}/swiftPasswords/" method = "GET" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "list_swift_passwords got unknown kwargs: {!r}".format(kwargs)) + "list_swift_passwords got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "userId": user_id @@ -2260,17 +2972,26 @@ def list_swift_passwords(self, user_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="list[SwiftPassword]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[SwiftPassword]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[SwiftPassword]") def list_tag_namespaces(self, compartment_id, **kwargs): """ ListTagNamespaces - List the tagNamespaces in a given compartment. + Lists the tag namespaces in the specified compartment. :param str compartment_id: (required) @@ -2283,8 +3004,8 @@ def list_tag_namespaces(self, compartment_id, **kwargs): The maximum number of items to return in a paginated \"List\" call. :param bool include_subcompartments: (optional) - An optional boolean parameter for whether or not to retrieve all tagNamespaces in sub compartments. In case - of absence of this parameter, only tagNamespaces that exist directly in this compartment will be retrieved. + An optional boolean parameter indicating whether to retrieve all tag namespaces in subcompartments. If this + parameter is not specified, only the tag namespaces defined in the specified compartment are retrieved. :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.identity.models.TagNamespaceSummary` :rtype: :class:`~oci.response.Response` @@ -2294,6 +3015,7 @@ def list_tag_namespaces(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit", "include_subcompartments" @@ -2316,21 +3038,30 @@ def list_tag_namespaces(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[TagNamespaceSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[TagNamespaceSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[TagNamespaceSummary]") def list_tags(self, tag_namespace_id, **kwargs): """ ListTags - List the tags that are defined in a given tagNamespace. + Lists the tag definitions in the specified tag namespace. :param str tag_namespace_id: (required) - The OCID of the tagNamespace + The OCID of the tag namespace. :param str page: (optional) The value of the `opc-next-page` response header from the previous \"List\" call. @@ -2346,6 +3077,7 @@ def list_tags(self, tag_namespace_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit" ] @@ -2375,13 +3107,23 @@ def list_tags(self, tag_namespace_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[TagSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[TagSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[TagSummary]") def list_user_group_memberships(self, compartment_id, **kwargs): """ @@ -2422,6 +3164,7 @@ def list_user_group_memberships(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "user_id", "group_id", "page", @@ -2446,12 +3189,21 @@ def list_user_group_memberships(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[UserGroupMembership]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[UserGroupMembership]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[UserGroupMembership]") def list_users(self, compartment_id, **kwargs): """ @@ -2480,6 +3232,7 @@ def list_users(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "page", "limit" ] @@ -2500,12 +3253,21 @@ def list_users(self, compartment_id, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[User]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[User]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[User]") def remove_user_from_group(self, user_group_membership_id, **kwargs): """ @@ -2529,6 +3291,7 @@ def remove_user_from_group(self, user_group_membership_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2553,11 +3316,19 @@ def remove_user_from_group(self, user_group_membership_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def update_compartment(self, compartment_id, update_compartment_details, **kwargs): """ @@ -2584,6 +3355,7 @@ def update_compartment(self, compartment_id, update_compartment_details, **kwarg # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2608,13 +3380,23 @@ def update_compartment(self, compartment_id, update_compartment_details, **kwarg } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_compartment_details, - response_type="Compartment") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_compartment_details, + response_type="Compartment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_compartment_details, + response_type="Compartment") def update_customer_secret_key(self, user_id, customer_secret_key_id, update_customer_secret_key_details, **kwargs): """ @@ -2644,6 +3426,7 @@ def update_customer_secret_key(self, user_id, customer_secret_key_id, update_cus # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2669,13 +3452,91 @@ def update_customer_secret_key(self, user_id, customer_secret_key_id, update_cus } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_customer_secret_key_details, - response_type="CustomerSecretKeySummary") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_customer_secret_key_details, + response_type="CustomerSecretKeySummary") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_customer_secret_key_details, + response_type="CustomerSecretKeySummary") + + def update_dynamic_group(self, dynamic_group_id, update_dynamic_group_details, **kwargs): + """ + UpdateDynamicGroup + Updates the specified dynamic group. + + + :param str dynamic_group_id: (required) + The OCID of the dynamic group. + + :param UpdateDynamicGroupDetails update_dynamic_group_details: (required) + Request object for updating an dynamic group. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + parameter to the value of the etag from a previous GET or POST response for that resource. The resource + will be updated or deleted only if the etag you provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.identity.models.DynamicGroup` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/dynamicGroups/{dynamicGroupId}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_dynamic_group got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "dynamicGroupId": dynamic_group_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_dynamic_group_details, + response_type="DynamicGroup") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_dynamic_group_details, + response_type="DynamicGroup") def update_group(self, group_id, update_group_details, **kwargs): """ @@ -2702,6 +3563,7 @@ def update_group(self, group_id, update_group_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2726,13 +3588,23 @@ def update_group(self, group_id, update_group_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_group_details, - response_type="Group") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_group_details, + response_type="Group") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_group_details, + response_type="Group") def update_identity_provider(self, identity_provider_id, update_identity_provider_details, **kwargs): """ @@ -2759,6 +3631,7 @@ def update_identity_provider(self, identity_provider_id, update_identity_provide # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2783,13 +3656,23 @@ def update_identity_provider(self, identity_provider_id, update_identity_provide } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_identity_provider_details, - response_type="IdentityProvider") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_identity_provider_details, + response_type="IdentityProvider") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_identity_provider_details, + response_type="IdentityProvider") def update_idp_group_mapping(self, identity_provider_id, mapping_id, update_idp_group_mapping_details, **kwargs): """ @@ -2819,6 +3702,7 @@ def update_idp_group_mapping(self, identity_provider_id, mapping_id, update_idp_ # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2844,13 +3728,23 @@ def update_idp_group_mapping(self, identity_provider_id, mapping_id, update_idp_ } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_idp_group_mapping_details, - response_type="IdpGroupMapping") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_idp_group_mapping_details, + response_type="IdpGroupMapping") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_idp_group_mapping_details, + response_type="IdpGroupMapping") def update_policy(self, policy_id, update_policy_details, **kwargs): """ @@ -2879,6 +3773,7 @@ def update_policy(self, policy_id, update_policy_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2903,13 +3798,23 @@ def update_policy(self, policy_id, update_policy_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_policy_details, - response_type="Policy") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_policy_details, + response_type="Policy") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_policy_details, + response_type="Policy") def update_swift_password(self, user_id, swift_password_id, update_swift_password_details, **kwargs): """ @@ -2939,6 +3844,7 @@ def update_swift_password(self, user_id, swift_password_id, update_swift_passwor # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -2964,28 +3870,35 @@ def update_swift_password(self, user_id, swift_password_id, update_swift_passwor } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_swift_password_details, - response_type="SwiftPassword") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_swift_password_details, + response_type="SwiftPassword") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_swift_password_details, + response_type="SwiftPassword") def update_tag(self, tag_namespace_id, tag_name, update_tag_details, **kwargs): """ UpdateTag - Updates the the specified tag. Only description and isRetired can be updated. Retiring a tag will also retire - the related rules. You can not a tag with the same name as a retired tag. Tags must be unique within their tag - namespace but can be repeated across namespaces. You cannot add a tag with the same name as a retired tag in - the same tag namespace. + Updates the the specified tag definition. You can update `description`, and `isRetired`. :param str tag_namespace_id: (required) - The OCID of the tagNamespace + The OCID of the tag namespace. :param str tag_name: (required) - The name of the tag + The name of the tag. :param UpdateTagDetails update_tag_details: (required) Request object for updating a tag. @@ -2996,9 +3909,11 @@ def update_tag(self, tag_namespace_id, tag_name, update_tag_details, **kwargs): resource_path = "/tagNamespaces/{tagNamespaceId}/tags/{tagName}" method = "PUT" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "update_tag got unknown kwargs: {!r}".format(kwargs)) + "update_tag got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "tagNamespaceId": tag_namespace_id, @@ -3016,26 +3931,42 @@ def update_tag(self, tag_namespace_id, tag_name, update_tag_details, **kwargs): "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_tag_details, - response_type="Tag") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_tag_details, + response_type="Tag") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_tag_details, + response_type="Tag") def update_tag_namespace(self, tag_namespace_id, update_tag_namespace_details, **kwargs): """ UpdateTagNamespace - Updates the the specified tagNamespace. Only description, isRetired and assigned tags can be updated. Updating - isRetired to be true will retire the namespace, all the contained tags and the related rules. Reactivating a - namespace will not reactivate any tag definition that was retired when the namespace was retired. They will - have to be individually reactivated *after* the namespace is reactivated. You can't add a namespace with the - same name as a retired namespace in the same tenant. + Updates the the specified tag namespace. You can't update the namespace name. + + Updating `isRetired` to 'true' retires the namespace and all the tag definitions in the namespace. Reactivating a + namespace (changing `isRetired` from 'true' to 'false') does not reactivate tag definitions. + To reactivate the tag definitions, you must reactivate each one indvidually *after* you reactivate the namespace, + using :func:`update_tag`. For more information about retiring tag namespaces, see + `Retiring Key Definitions and Namespace Definitions`__. + + You can't add a namespace with the same name as a retired namespace in the same tenancy. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :param str tag_namespace_id: (required) - The OCID of the tagNamespace + The OCID of the tag namespace. :param UpdateTagNamespaceDetails update_tag_namespace_details: (required) Request object for updating a namespace. @@ -3046,9 +3977,11 @@ def update_tag_namespace(self, tag_namespace_id, update_tag_namespace_details, * resource_path = "/tagNamespaces/{tagNamespaceId}" method = "PUT" - if kwargs: + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: raise ValueError( - "update_tag_namespace got unknown kwargs: {!r}".format(kwargs)) + "update_tag_namespace got unknown kwargs: {!r}".format(extra_kwargs)) path_params = { "tagNamespaceId": tag_namespace_id @@ -3065,13 +3998,23 @@ def update_tag_namespace(self, tag_namespace_id, update_tag_namespace_details, * "content-type": "application/json" } - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_tag_namespace_details, - response_type="TagNamespace") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_tag_namespace_details, + response_type="TagNamespace") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_tag_namespace_details, + response_type="TagNamespace") def update_user(self, user_id, update_user_details, **kwargs): """ @@ -3098,6 +4041,7 @@ def update_user(self, user_id, update_user_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -3122,13 +4066,23 @@ def update_user(self, user_id, update_user_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_user_details, - response_type="User") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_user_details, + response_type="User") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_user_details, + response_type="User") def update_user_state(self, user_id, update_state_details, **kwargs): """ @@ -3155,6 +4109,7 @@ def update_user_state(self, user_id, update_state_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -3179,13 +4134,23 @@ def update_user_state(self, user_id, update_state_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_state_details, - response_type="User") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_state_details, + response_type="User") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_state_details, + response_type="User") def upload_api_key(self, user_id, create_api_key_details, **kwargs): """ @@ -3228,6 +4193,7 @@ def upload_api_key(self, user_id, create_api_key_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_retry_token" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -3252,10 +4218,22 @@ def upload_api_key(self, user_id, create_api_key_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_api_key_details, - response_type="ApiKey") + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_api_key_details, + response_type="ApiKey") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_api_key_details, + response_type="ApiKey") diff --git a/src/oci/identity/models/__init__.py b/src/oci/identity/models/__init__.py index 51c599c56c..3db68dc5d3 100644 --- a/src/oci/identity/models/__init__.py +++ b/src/oci/identity/models/__init__.py @@ -10,6 +10,7 @@ from .create_api_key_details import CreateApiKeyDetails from .create_compartment_details import CreateCompartmentDetails from .create_customer_secret_key_details import CreateCustomerSecretKeyDetails +from .create_dynamic_group_details import CreateDynamicGroupDetails from .create_group_details import CreateGroupDetails from .create_identity_provider_details import CreateIdentityProviderDetails from .create_idp_group_mapping_details import CreateIdpGroupMappingDetails @@ -22,6 +23,7 @@ from .create_user_details import CreateUserDetails from .customer_secret_key import CustomerSecretKey from .customer_secret_key_summary import CustomerSecretKeySummary +from .dynamic_group import DynamicGroup from .group import Group from .identity_provider import IdentityProvider from .idp_group_mapping import IdpGroupMapping @@ -38,6 +40,7 @@ from .ui_password import UIPassword from .update_compartment_details import UpdateCompartmentDetails from .update_customer_secret_key_details import UpdateCustomerSecretKeyDetails +from .update_dynamic_group_details import UpdateDynamicGroupDetails from .update_group_details import UpdateGroupDetails from .update_identity_provider_details import UpdateIdentityProviderDetails from .update_idp_group_mapping_details import UpdateIdpGroupMappingDetails @@ -60,6 +63,7 @@ "CreateApiKeyDetails": CreateApiKeyDetails, "CreateCompartmentDetails": CreateCompartmentDetails, "CreateCustomerSecretKeyDetails": CreateCustomerSecretKeyDetails, + "CreateDynamicGroupDetails": CreateDynamicGroupDetails, "CreateGroupDetails": CreateGroupDetails, "CreateIdentityProviderDetails": CreateIdentityProviderDetails, "CreateIdpGroupMappingDetails": CreateIdpGroupMappingDetails, @@ -72,6 +76,7 @@ "CreateUserDetails": CreateUserDetails, "CustomerSecretKey": CustomerSecretKey, "CustomerSecretKeySummary": CustomerSecretKeySummary, + "DynamicGroup": DynamicGroup, "Group": Group, "IdentityProvider": IdentityProvider, "IdpGroupMapping": IdpGroupMapping, @@ -88,6 +93,7 @@ "UIPassword": UIPassword, "UpdateCompartmentDetails": UpdateCompartmentDetails, "UpdateCustomerSecretKeyDetails": UpdateCustomerSecretKeyDetails, + "UpdateDynamicGroupDetails": UpdateDynamicGroupDetails, "UpdateGroupDetails": UpdateGroupDetails, "UpdateIdentityProviderDetails": UpdateIdentityProviderDetails, "UpdateIdpGroupMappingDetails": UpdateIdpGroupMappingDetails, diff --git a/src/oci/identity/models/compartment.py b/src/oci/identity/models/compartment.py index 3d27fd83f2..18fccab054 100644 --- a/src/oci/identity/models/compartment.py +++ b/src/oci/identity/models/compartment.py @@ -273,8 +273,11 @@ def inactive_status(self, inactive_status): def freeform_tags(self): """ Gets the freeform_tags of this Compartment. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this Compartment. @@ -286,8 +289,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this Compartment. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this Compartment. @@ -299,8 +305,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this Compartment. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this Compartment. @@ -312,8 +321,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this Compartment. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this Compartment. diff --git a/src/oci/identity/models/create_compartment_details.py b/src/oci/identity/models/create_compartment_details.py index 1b690c6a8d..dded268183 100644 --- a/src/oci/identity/models/create_compartment_details.py +++ b/src/oci/identity/models/create_compartment_details.py @@ -135,8 +135,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this CreateCompartmentDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this CreateCompartmentDetails. @@ -148,8 +151,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this CreateCompartmentDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this CreateCompartmentDetails. @@ -161,8 +167,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this CreateCompartmentDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this CreateCompartmentDetails. @@ -174,8 +183,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this CreateCompartmentDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this CreateCompartmentDetails. diff --git a/src/oci/identity/models/create_dynamic_group_details.py b/src/oci/identity/models/create_dynamic_group_details.py new file mode 100644 index 0000000000..8ff4ed8579 --- /dev/null +++ b/src/oci/identity/models/create_dynamic_group_details.py @@ -0,0 +1,161 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class CreateDynamicGroupDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreateDynamicGroupDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param compartment_id: + The value to assign to the compartment_id property of this CreateDynamicGroupDetails. + :type compartment_id: str + + :param name: + The value to assign to the name property of this CreateDynamicGroupDetails. + :type name: str + + :param matching_rule: + The value to assign to the matching_rule property of this CreateDynamicGroupDetails. + :type matching_rule: str + + :param description: + The value to assign to the description property of this CreateDynamicGroupDetails. + :type description: str + + """ + self.swagger_types = { + 'compartment_id': 'str', + 'name': 'str', + 'matching_rule': 'str', + 'description': 'str' + } + + self.attribute_map = { + 'compartment_id': 'compartmentId', + 'name': 'name', + 'matching_rule': 'matchingRule', + 'description': 'description' + } + + self._compartment_id = None + self._name = None + self._matching_rule = None + self._description = None + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this CreateDynamicGroupDetails. + The OCID of the tenancy containing the group. + + + :return: The compartment_id of this CreateDynamicGroupDetails. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this CreateDynamicGroupDetails. + The OCID of the tenancy containing the group. + + + :param compartment_id: The compartment_id of this CreateDynamicGroupDetails. + :type: str + """ + self._compartment_id = compartment_id + + @property + def name(self): + """ + **[Required]** Gets the name of this CreateDynamicGroupDetails. + The name you assign to the group during creation. The name must be unique across all groups + in the tenancy and cannot be changed. + + + :return: The name of this CreateDynamicGroupDetails. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this CreateDynamicGroupDetails. + The name you assign to the group during creation. The name must be unique across all groups + in the tenancy and cannot be changed. + + + :param name: The name of this CreateDynamicGroupDetails. + :type: str + """ + self._name = name + + @property + def matching_rule(self): + """ + **[Required]** Gets the matching_rule of this CreateDynamicGroupDetails. + The matching rule to dynamically match an instance certificate to this dynamic group + + + :return: The matching_rule of this CreateDynamicGroupDetails. + :rtype: str + """ + return self._matching_rule + + @matching_rule.setter + def matching_rule(self, matching_rule): + """ + Sets the matching_rule of this CreateDynamicGroupDetails. + The matching rule to dynamically match an instance certificate to this dynamic group + + + :param matching_rule: The matching_rule of this CreateDynamicGroupDetails. + :type: str + """ + self._matching_rule = matching_rule + + @property + def description(self): + """ + **[Required]** Gets the description of this CreateDynamicGroupDetails. + The description you assign to the group during creation. Does not have to be unique, and it's changeable. + + + :return: The description of this CreateDynamicGroupDetails. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """ + Sets the description of this CreateDynamicGroupDetails. + The description you assign to the group during creation. Does not have to be unique, and it's changeable. + + + :param description: The description of this CreateDynamicGroupDetails. + :type: str + """ + self._description = description + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/identity/models/create_group_details.py b/src/oci/identity/models/create_group_details.py index bdef020234..db7074a795 100644 --- a/src/oci/identity/models/create_group_details.py +++ b/src/oci/identity/models/create_group_details.py @@ -135,8 +135,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this CreateGroupDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this CreateGroupDetails. @@ -148,8 +151,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this CreateGroupDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this CreateGroupDetails. @@ -161,8 +167,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this CreateGroupDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this CreateGroupDetails. @@ -174,8 +183,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this CreateGroupDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this CreateGroupDetails. diff --git a/src/oci/identity/models/create_identity_provider_details.py b/src/oci/identity/models/create_identity_provider_details.py index 11d69704c9..200243b2d1 100644 --- a/src/oci/identity/models/create_identity_provider_details.py +++ b/src/oci/identity/models/create_identity_provider_details.py @@ -248,8 +248,11 @@ def protocol(self, protocol): def freeform_tags(self): """ Gets the freeform_tags of this CreateIdentityProviderDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this CreateIdentityProviderDetails. @@ -261,8 +264,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this CreateIdentityProviderDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this CreateIdentityProviderDetails. @@ -274,8 +280,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this CreateIdentityProviderDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this CreateIdentityProviderDetails. @@ -287,8 +296,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this CreateIdentityProviderDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this CreateIdentityProviderDetails. diff --git a/src/oci/identity/models/create_policy_details.py b/src/oci/identity/models/create_policy_details.py index 16ea098dec..d9c80be1b2 100644 --- a/src/oci/identity/models/create_policy_details.py +++ b/src/oci/identity/models/create_policy_details.py @@ -211,8 +211,11 @@ def version_date(self, version_date): def freeform_tags(self): """ Gets the freeform_tags of this CreatePolicyDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this CreatePolicyDetails. @@ -224,8 +227,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this CreatePolicyDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this CreatePolicyDetails. @@ -237,8 +243,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this CreatePolicyDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this CreatePolicyDetails. @@ -250,8 +259,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this CreatePolicyDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this CreatePolicyDetails. diff --git a/src/oci/identity/models/create_tag_details.py b/src/oci/identity/models/create_tag_details.py index 392c1e619a..4953720e2e 100644 --- a/src/oci/identity/models/create_tag_details.py +++ b/src/oci/identity/models/create_tag_details.py @@ -54,7 +54,7 @@ def __init__(self, **kwargs): def name(self): """ **[Required]** Gets the name of this CreateTagDetails. - The name of the tag which must be unique across all tags in the tagNamespace and cannot be changed. + The name you assign to the tag during creation. The name must be unique within the tag namespace and cannot be changed. :return: The name of this CreateTagDetails. @@ -66,7 +66,7 @@ def name(self): def name(self, name): """ Sets the name of this CreateTagDetails. - The name of the tag which must be unique across all tags in the tagNamespace and cannot be changed. + The name you assign to the tag during creation. The name must be unique within the tag namespace and cannot be changed. :param name: The name of this CreateTagDetails. @@ -78,7 +78,7 @@ def name(self, name): def description(self): """ **[Required]** Gets the description of this CreateTagDetails. - The description of the tag. + The description you assign to the tag during creation. :return: The description of this CreateTagDetails. @@ -90,7 +90,7 @@ def description(self): def description(self, description): """ Sets the description of this CreateTagDetails. - The description of the tag. + The description you assign to the tag during creation. :param description: The description of this CreateTagDetails. @@ -102,8 +102,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this CreateTagDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this CreateTagDetails. @@ -115,8 +118,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this CreateTagDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this CreateTagDetails. @@ -128,8 +134,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this CreateTagDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this CreateTagDetails. @@ -141,8 +150,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this CreateTagDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this CreateTagDetails. diff --git a/src/oci/identity/models/create_tag_namespace_details.py b/src/oci/identity/models/create_tag_namespace_details.py index e78b0bd37b..0260ebba43 100644 --- a/src/oci/identity/models/create_tag_namespace_details.py +++ b/src/oci/identity/models/create_tag_namespace_details.py @@ -61,7 +61,7 @@ def __init__(self, **kwargs): def compartment_id(self): """ **[Required]** Gets the compartment_id of this CreateTagNamespaceDetails. - The OCID of the tenancy containing the user. + The OCID of the tenancy containing the tag namespace. :return: The compartment_id of this CreateTagNamespaceDetails. @@ -73,7 +73,7 @@ def compartment_id(self): def compartment_id(self, compartment_id): """ Sets the compartment_id of this CreateTagNamespaceDetails. - The OCID of the tenancy containing the user. + The OCID of the tenancy containing the tag namespace. :param compartment_id: The compartment_id of this CreateTagNamespaceDetails. @@ -85,7 +85,7 @@ def compartment_id(self, compartment_id): def name(self): """ **[Required]** Gets the name of this CreateTagNamespaceDetails. - The name of the tagNamespace. It must be unique across all tagNamespaces in the tenancy and cannot be changed. + The name you assign to the tag namespace during creation. It must be unique across all tag namespaces in the tenancy and cannot be changed. :return: The name of this CreateTagNamespaceDetails. @@ -97,7 +97,7 @@ def name(self): def name(self, name): """ Sets the name of this CreateTagNamespaceDetails. - The name of the tagNamespace. It must be unique across all tagNamespaces in the tenancy and cannot be changed. + The name you assign to the tag namespace during creation. It must be unique across all tag namespaces in the tenancy and cannot be changed. :param name: The name of this CreateTagNamespaceDetails. @@ -109,7 +109,7 @@ def name(self, name): def description(self): """ **[Required]** Gets the description of this CreateTagNamespaceDetails. - The description of the tagNamespace. + The description you assign to the tag namespace during creation. :return: The description of this CreateTagNamespaceDetails. @@ -121,7 +121,7 @@ def description(self): def description(self, description): """ Sets the description of this CreateTagNamespaceDetails. - The description of the tagNamespace. + The description you assign to the tag namespace during creation. :param description: The description of this CreateTagNamespaceDetails. @@ -133,8 +133,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this CreateTagNamespaceDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this CreateTagNamespaceDetails. @@ -146,8 +149,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this CreateTagNamespaceDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this CreateTagNamespaceDetails. @@ -159,8 +165,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this CreateTagNamespaceDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this CreateTagNamespaceDetails. @@ -172,8 +181,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this CreateTagNamespaceDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this CreateTagNamespaceDetails. diff --git a/src/oci/identity/models/create_user_details.py b/src/oci/identity/models/create_user_details.py index c55a4d5600..371983fd8a 100644 --- a/src/oci/identity/models/create_user_details.py +++ b/src/oci/identity/models/create_user_details.py @@ -135,8 +135,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this CreateUserDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this CreateUserDetails. @@ -148,8 +151,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this CreateUserDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this CreateUserDetails. @@ -161,8 +167,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this CreateUserDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this CreateUserDetails. @@ -174,8 +183,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this CreateUserDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this CreateUserDetails. diff --git a/src/oci/identity/models/dynamic_group.py b/src/oci/identity/models/dynamic_group.py new file mode 100644 index 0000000000..ae6341b746 --- /dev/null +++ b/src/oci/identity/models/dynamic_group.py @@ -0,0 +1,299 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class DynamicGroup(object): + + def __init__(self, **kwargs): + """ + Initializes a new DynamicGroup object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param id: + The value to assign to the id property of this DynamicGroup. + :type id: str + + :param compartment_id: + The value to assign to the compartment_id property of this DynamicGroup. + :type compartment_id: str + + :param name: + The value to assign to the name property of this DynamicGroup. + :type name: str + + :param description: + The value to assign to the description property of this DynamicGroup. + :type description: str + + :param matching_rule: + The value to assign to the matching_rule property of this DynamicGroup. + :type matching_rule: str + + :param time_created: + The value to assign to the time_created property of this DynamicGroup. + :type time_created: datetime + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this DynamicGroup. + Allowed values for this property are: "CREATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param inactive_status: + The value to assign to the inactive_status property of this DynamicGroup. + :type inactive_status: int + + """ + self.swagger_types = { + 'id': 'str', + 'compartment_id': 'str', + 'name': 'str', + 'description': 'str', + 'matching_rule': 'str', + 'time_created': 'datetime', + 'lifecycle_state': 'str', + 'inactive_status': 'int' + } + + self.attribute_map = { + 'id': 'id', + 'compartment_id': 'compartmentId', + 'name': 'name', + 'description': 'description', + 'matching_rule': 'matchingRule', + 'time_created': 'timeCreated', + 'lifecycle_state': 'lifecycleState', + 'inactive_status': 'inactiveStatus' + } + + self._id = None + self._compartment_id = None + self._name = None + self._description = None + self._matching_rule = None + self._time_created = None + self._lifecycle_state = None + self._inactive_status = None + + @property + def id(self): + """ + **[Required]** Gets the id of this DynamicGroup. + The OCID of the group. + + + :return: The id of this DynamicGroup. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this DynamicGroup. + The OCID of the group. + + + :param id: The id of this DynamicGroup. + :type: str + """ + self._id = id + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this DynamicGroup. + The OCID of the tenancy containing the group. + + + :return: The compartment_id of this DynamicGroup. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this DynamicGroup. + The OCID of the tenancy containing the group. + + + :param compartment_id: The compartment_id of this DynamicGroup. + :type: str + """ + self._compartment_id = compartment_id + + @property + def name(self): + """ + **[Required]** Gets the name of this DynamicGroup. + The name you assign to the group during creation. The name must be unique across all groups in + the tenancy and cannot be changed. + + + :return: The name of this DynamicGroup. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this DynamicGroup. + The name you assign to the group during creation. The name must be unique across all groups in + the tenancy and cannot be changed. + + + :param name: The name of this DynamicGroup. + :type: str + """ + self._name = name + + @property + def description(self): + """ + **[Required]** Gets the description of this DynamicGroup. + The description you assign to the group. Does not have to be unique, and it's changeable. + + + :return: The description of this DynamicGroup. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """ + Sets the description of this DynamicGroup. + The description you assign to the group. Does not have to be unique, and it's changeable. + + + :param description: The description of this DynamicGroup. + :type: str + """ + self._description = description + + @property + def matching_rule(self): + """ + **[Required]** Gets the matching_rule of this DynamicGroup. + A rule string that defines which instance certificates will be matched. + + + :return: The matching_rule of this DynamicGroup. + :rtype: str + """ + return self._matching_rule + + @matching_rule.setter + def matching_rule(self, matching_rule): + """ + Sets the matching_rule of this DynamicGroup. + A rule string that defines which instance certificates will be matched. + + + :param matching_rule: The matching_rule of this DynamicGroup. + :type: str + """ + self._matching_rule = matching_rule + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this DynamicGroup. + Date and time the group was created, in the format defined by RFC3339. + + Example: `2016-08-25T21:10:29.600Z` + + + :return: The time_created of this DynamicGroup. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this DynamicGroup. + Date and time the group was created, in the format defined by RFC3339. + + Example: `2016-08-25T21:10:29.600Z` + + + :param time_created: The time_created of this DynamicGroup. + :type: datetime + """ + self._time_created = time_created + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this DynamicGroup. + The group's current state. After creating a group, make sure its `lifecycleState` changes from CREATING to + ACTIVE before using it. + + Allowed values for this property are: "CREATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this DynamicGroup. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this DynamicGroup. + The group's current state. After creating a group, make sure its `lifecycleState` changes from CREATING to + ACTIVE before using it. + + + :param lifecycle_state: The lifecycle_state of this DynamicGroup. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def inactive_status(self): + """ + Gets the inactive_status of this DynamicGroup. + The detailed status of INACTIVE lifecycleState. + + + :return: The inactive_status of this DynamicGroup. + :rtype: int + """ + return self._inactive_status + + @inactive_status.setter + def inactive_status(self, inactive_status): + """ + Sets the inactive_status of this DynamicGroup. + The detailed status of INACTIVE lifecycleState. + + + :param inactive_status: The inactive_status of this DynamicGroup. + :type: int + """ + self._inactive_status = inactive_status + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/identity/models/group.py b/src/oci/identity/models/group.py index 51d164ad49..f4a70a9359 100644 --- a/src/oci/identity/models/group.py +++ b/src/oci/identity/models/group.py @@ -273,9 +273,11 @@ def inactive_status(self, inactive_status): def freeform_tags(self): """ Gets the freeform_tags of this Group. - Simple key-value pair that is applied without any predefined name, type or scope. Exists solely for - compatibility with other cloud provider tagging schemes. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this Group. @@ -287,9 +289,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this Group. - Simple key-value pair that is applied without any predefined name, type or scope. Exists solely for - compatibility with other cloud provider tagging schemes. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this Group. @@ -301,8 +305,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this Group. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this Group. @@ -314,8 +321,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this Group. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this Group. diff --git a/src/oci/identity/models/identity_provider.py b/src/oci/identity/models/identity_provider.py index 4e66d2d193..d1e5d9940a 100644 --- a/src/oci/identity/models/identity_provider.py +++ b/src/oci/identity/models/identity_provider.py @@ -380,8 +380,11 @@ def protocol(self, protocol): def freeform_tags(self): """ Gets the freeform_tags of this IdentityProvider. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this IdentityProvider. @@ -393,8 +396,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this IdentityProvider. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this IdentityProvider. @@ -406,8 +412,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this IdentityProvider. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this IdentityProvider. @@ -419,8 +428,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this IdentityProvider. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this IdentityProvider. diff --git a/src/oci/identity/models/policy.py b/src/oci/identity/models/policy.py index ce9afef500..831d61d9c1 100644 --- a/src/oci/identity/models/policy.py +++ b/src/oci/identity/models/policy.py @@ -339,8 +339,11 @@ def version_date(self, version_date): def freeform_tags(self): """ Gets the freeform_tags of this Policy. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this Policy. @@ -352,8 +355,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this Policy. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this Policy. @@ -365,8 +371,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this Policy. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this Policy. @@ -378,8 +387,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this Policy. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this Policy. diff --git a/src/oci/identity/models/tag.py b/src/oci/identity/models/tag.py index 620116d52f..9d691c000d 100644 --- a/src/oci/identity/models/tag.py +++ b/src/oci/identity/models/tag.py @@ -96,7 +96,7 @@ def __init__(self, **kwargs): def compartment_id(self): """ **[Required]** Gets the compartment_id of this Tag. - The OCID of the compartment which the tagRule belongs to. + The OCID of the compartment that contains the tag definition. :return: The compartment_id of this Tag. @@ -108,7 +108,7 @@ def compartment_id(self): def compartment_id(self, compartment_id): """ Sets the compartment_id of this Tag. - The OCID of the compartment which the tagRule belongs to. + The OCID of the compartment that contains the tag definition. :param compartment_id: The compartment_id of this Tag. @@ -120,7 +120,7 @@ def compartment_id(self, compartment_id): def tag_namespace_id(self): """ **[Required]** Gets the tag_namespace_id of this Tag. - The OCID of the containing tagNamespace. + The OCID of the namespace that contains the tag definition. :return: The tag_namespace_id of this Tag. @@ -132,7 +132,7 @@ def tag_namespace_id(self): def tag_namespace_id(self, tag_namespace_id): """ Sets the tag_namespace_id of this Tag. - The OCID of the containing tagNamespace. + The OCID of the namespace that contains the tag definition. :param tag_namespace_id: The tag_namespace_id of this Tag. @@ -144,7 +144,7 @@ def tag_namespace_id(self, tag_namespace_id): def tag_namespace_name(self): """ **[Required]** Gets the tag_namespace_name of this Tag. - The name of the tag namespace to which this tag belongs. + The name of the tag namespace that contains the tag definition. :return: The tag_namespace_name of this Tag. @@ -156,7 +156,7 @@ def tag_namespace_name(self): def tag_namespace_name(self, tag_namespace_name): """ Sets the tag_namespace_name of this Tag. - The name of the tag namespace to which this tag belongs. + The name of the tag namespace that contains the tag definition. :param tag_namespace_name: The tag_namespace_name of this Tag. @@ -192,7 +192,7 @@ def id(self, id): def name(self): """ **[Required]** Gets the name of this Tag. - The name of the tag which must be unique across all tags in the tagNamespace and cannot be changed. + The name of the tag. The name must be unique across all tags in the namespace and can't be changed. :return: The name of this Tag. @@ -204,7 +204,7 @@ def name(self): def name(self, name): """ Sets the name of this Tag. - The name of the tag which must be unique across all tags in the tagNamespace and cannot be changed. + The name of the tag. The name must be unique across all tags in the namespace and can't be changed. :param name: The name of this Tag. @@ -240,8 +240,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this Tag. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this Tag. @@ -253,8 +256,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this Tag. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this Tag. @@ -266,8 +272,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this Tag. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this Tag. @@ -279,8 +288,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this Tag. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this Tag. @@ -292,7 +304,10 @@ def defined_tags(self, defined_tags): def is_retired(self): """ **[Required]** Gets the is_retired of this Tag. - Indicated whether the tagNamespace is retired or not + Indicates whether the tag is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :return: The is_retired of this Tag. @@ -304,7 +319,10 @@ def is_retired(self): def is_retired(self, is_retired): """ Sets the is_retired of this Tag. - Indicated whether the tagNamespace is retired or not + Indicates whether the tag is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :param is_retired: The is_retired of this Tag. diff --git a/src/oci/identity/models/tag_namespace.py b/src/oci/identity/models/tag_namespace.py index f7f008035b..64c559b2e9 100644 --- a/src/oci/identity/models/tag_namespace.py +++ b/src/oci/identity/models/tag_namespace.py @@ -82,7 +82,7 @@ def __init__(self, **kwargs): def id(self): """ **[Required]** Gets the id of this TagNamespace. - The OCID of the tagNamespace. + The OCID of the tag namespace. :return: The id of this TagNamespace. @@ -94,7 +94,7 @@ def id(self): def id(self, id): """ Sets the id of this TagNamespace. - The OCID of the tagNamespace. + The OCID of the tag namespace. :param id: The id of this TagNamespace. @@ -106,7 +106,7 @@ def id(self, id): def compartment_id(self): """ **[Required]** Gets the compartment_id of this TagNamespace. - The OCID of the compartment which the namespace is attached to. + The OCID of the compartment that contains the tag namespace. :return: The compartment_id of this TagNamespace. @@ -118,7 +118,7 @@ def compartment_id(self): def compartment_id(self, compartment_id): """ Sets the compartment_id of this TagNamespace. - The OCID of the compartment which the namespace is attached to. + The OCID of the compartment that contains the tag namespace. :param compartment_id: The compartment_id of this TagNamespace. @@ -130,7 +130,7 @@ def compartment_id(self, compartment_id): def name(self): """ **[Required]** Gets the name of this TagNamespace. - The name of the tagNamespace. It must be unique across all tagNamespaces in the tenancy and cannot be changed. + The name of the tag namespace. It must be unique across all tag namespaces in the tenancy and cannot be changed. :return: The name of this TagNamespace. @@ -142,7 +142,7 @@ def name(self): def name(self, name): """ Sets the name of this TagNamespace. - The name of the tagNamespace. It must be unique across all tagNamespaces in the tenancy and cannot be changed. + The name of the tag namespace. It must be unique across all tag namespaces in the tenancy and cannot be changed. :param name: The name of this TagNamespace. @@ -154,7 +154,7 @@ def name(self, name): def description(self): """ **[Required]** Gets the description of this TagNamespace. - The description you assign to the tagNamespace. + The description you assign to the tag namespace. :return: The description of this TagNamespace. @@ -166,7 +166,7 @@ def description(self): def description(self, description): """ Sets the description of this TagNamespace. - The description you assign to the tagNamespace. + The description you assign to the tag namespace. :param description: The description of this TagNamespace. @@ -178,8 +178,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this TagNamespace. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this TagNamespace. @@ -191,8 +194,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this TagNamespace. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this TagNamespace. @@ -204,8 +210,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this TagNamespace. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this TagNamespace. @@ -217,8 +226,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this TagNamespace. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this TagNamespace. @@ -230,7 +242,10 @@ def defined_tags(self, defined_tags): def is_retired(self): """ **[Required]** Gets the is_retired of this TagNamespace. - Indicated whether or not the tagNamespace is retired + Whether the tag namespace is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :return: The is_retired of this TagNamespace. @@ -242,7 +257,10 @@ def is_retired(self): def is_retired(self, is_retired): """ Sets the is_retired of this TagNamespace. - Indicated whether or not the tagNamespace is retired + Whether the tag namespace is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :param is_retired: The is_retired of this TagNamespace. diff --git a/src/oci/identity/models/tag_namespace_summary.py b/src/oci/identity/models/tag_namespace_summary.py index b4e9941402..55bed481a0 100644 --- a/src/oci/identity/models/tag_namespace_summary.py +++ b/src/oci/identity/models/tag_namespace_summary.py @@ -82,7 +82,7 @@ def __init__(self, **kwargs): def id(self): """ Gets the id of this TagNamespaceSummary. - The OCID of the tagNamespace. + The OCID of the tag namespace. :return: The id of this TagNamespaceSummary. @@ -94,7 +94,7 @@ def id(self): def id(self, id): """ Sets the id of this TagNamespaceSummary. - The OCID of the tagNamespace. + The OCID of the tag namespace. :param id: The id of this TagNamespaceSummary. @@ -106,7 +106,7 @@ def id(self, id): def compartment_id(self): """ Gets the compartment_id of this TagNamespaceSummary. - The OCID of the compartment to which the namespace is attached. + The OCID of the compartment that contains the tag namespace. :return: The compartment_id of this TagNamespaceSummary. @@ -118,7 +118,7 @@ def compartment_id(self): def compartment_id(self, compartment_id): """ Sets the compartment_id of this TagNamespaceSummary. - The OCID of the compartment to which the namespace is attached. + The OCID of the compartment that contains the tag namespace. :param compartment_id: The compartment_id of this TagNamespaceSummary. @@ -130,7 +130,7 @@ def compartment_id(self, compartment_id): def name(self): """ Gets the name of this TagNamespaceSummary. - The name of the tagNamespace. It must be unique across all tagNamespaces in the tenancy and cannot be changed. + The name of the tag namespace. It must be unique across all tag namespaces in the tenancy and cannot be changed. :return: The name of this TagNamespaceSummary. @@ -142,7 +142,7 @@ def name(self): def name(self, name): """ Sets the name of this TagNamespaceSummary. - The name of the tagNamespace. It must be unique across all tagNamespaces in the tenancy and cannot be changed. + The name of the tag namespace. It must be unique across all tag namespaces in the tenancy and cannot be changed. :param name: The name of this TagNamespaceSummary. @@ -154,7 +154,7 @@ def name(self, name): def description(self): """ Gets the description of this TagNamespaceSummary. - The description you assign to the tagNamespace. + The description you assign to the tag namespace. :return: The description of this TagNamespaceSummary. @@ -166,7 +166,7 @@ def description(self): def description(self, description): """ Sets the description of this TagNamespaceSummary. - The description you assign to the tagNamespace. + The description you assign to the tag namespace. :param description: The description of this TagNamespaceSummary. @@ -178,8 +178,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this TagNamespaceSummary. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this TagNamespaceSummary. @@ -191,8 +194,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this TagNamespaceSummary. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this TagNamespaceSummary. @@ -204,8 +210,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this TagNamespaceSummary. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this TagNamespaceSummary. @@ -217,8 +226,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this TagNamespaceSummary. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this TagNamespaceSummary. @@ -230,7 +242,10 @@ def defined_tags(self, defined_tags): def is_retired(self): """ Gets the is_retired of this TagNamespaceSummary. - Indicated whether or not the tagNamespace is retired + Whether the tag namespace is retired. + For more information, see `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :return: The is_retired of this TagNamespaceSummary. @@ -242,7 +257,10 @@ def is_retired(self): def is_retired(self, is_retired): """ Sets the is_retired of this TagNamespaceSummary. - Indicated whether or not the tagNamespace is retired + Whether the tag namespace is retired. + For more information, see `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :param is_retired: The is_retired of this TagNamespaceSummary. diff --git a/src/oci/identity/models/tag_summary.py b/src/oci/identity/models/tag_summary.py index 76ce75b486..8ce19875b2 100644 --- a/src/oci/identity/models/tag_summary.py +++ b/src/oci/identity/models/tag_summary.py @@ -82,7 +82,7 @@ def __init__(self, **kwargs): def compartment_id(self): """ Gets the compartment_id of this TagSummary. - The OCID of the compartment which the tag definition is attached to. + The OCID of the compartment that contains the tag definition. :return: The compartment_id of this TagSummary. @@ -94,7 +94,7 @@ def compartment_id(self): def compartment_id(self, compartment_id): """ Sets the compartment_id of this TagSummary. - The OCID of the compartment which the tag definition is attached to. + The OCID of the compartment that contains the tag definition. :param compartment_id: The compartment_id of this TagSummary. @@ -130,7 +130,7 @@ def id(self, id): def name(self): """ Gets the name of this TagSummary. - The name of the tag which must be unique across all tags in the tagNamespace and cannot be changed. + The name of the tag. The name must be unique across all tags in the tag namespace and can't be changed. :return: The name of this TagSummary. @@ -142,7 +142,7 @@ def name(self): def name(self, name): """ Sets the name of this TagSummary. - The name of the tag which must be unique across all tags in the tagNamespace and cannot be changed. + The name of the tag. The name must be unique across all tags in the tag namespace and can't be changed. :param name: The name of this TagSummary. @@ -178,8 +178,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this TagSummary. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this TagSummary. @@ -191,8 +194,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this TagSummary. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this TagSummary. @@ -204,8 +210,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this TagSummary. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this TagSummary. @@ -217,8 +226,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this TagSummary. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this TagSummary. @@ -230,7 +242,10 @@ def defined_tags(self, defined_tags): def is_retired(self): """ Gets the is_retired of this TagSummary. - Indicated whether or not the tag is retired + Whether the tag is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :return: The is_retired of this TagSummary. @@ -242,7 +257,10 @@ def is_retired(self): def is_retired(self, is_retired): """ Sets the is_retired of this TagSummary. - Indicated whether or not the tag is retired + Whether the tag is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :param is_retired: The is_retired of this TagSummary. diff --git a/src/oci/identity/models/tenancy.py b/src/oci/identity/models/tenancy.py index 3c1219a8f0..4eac72bbc4 100644 --- a/src/oci/identity/models/tenancy.py +++ b/src/oci/identity/models/tenancy.py @@ -174,8 +174,11 @@ def home_region_key(self, home_region_key): def freeform_tags(self): """ Gets the freeform_tags of this Tenancy. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this Tenancy. @@ -187,8 +190,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this Tenancy. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this Tenancy. @@ -200,8 +206,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this Tenancy. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this Tenancy. @@ -213,8 +222,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this Tenancy. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this Tenancy. diff --git a/src/oci/identity/models/update_compartment_details.py b/src/oci/identity/models/update_compartment_details.py index d63693faa8..71b8905602 100644 --- a/src/oci/identity/models/update_compartment_details.py +++ b/src/oci/identity/models/update_compartment_details.py @@ -102,8 +102,11 @@ def name(self, name): def freeform_tags(self): """ Gets the freeform_tags of this UpdateCompartmentDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this UpdateCompartmentDetails. @@ -115,8 +118,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this UpdateCompartmentDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this UpdateCompartmentDetails. @@ -128,8 +134,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this UpdateCompartmentDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this UpdateCompartmentDetails. @@ -141,8 +150,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this UpdateCompartmentDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this UpdateCompartmentDetails. diff --git a/src/oci/identity/models/update_dynamic_group_details.py b/src/oci/identity/models/update_dynamic_group_details.py new file mode 100644 index 0000000000..92ac4ab1cf --- /dev/null +++ b/src/oci/identity/models/update_dynamic_group_details.py @@ -0,0 +1,97 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class UpdateDynamicGroupDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateDynamicGroupDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param description: + The value to assign to the description property of this UpdateDynamicGroupDetails. + :type description: str + + :param matching_rule: + The value to assign to the matching_rule property of this UpdateDynamicGroupDetails. + :type matching_rule: str + + """ + self.swagger_types = { + 'description': 'str', + 'matching_rule': 'str' + } + + self.attribute_map = { + 'description': 'description', + 'matching_rule': 'matchingRule' + } + + self._description = None + self._matching_rule = None + + @property + def description(self): + """ + Gets the description of this UpdateDynamicGroupDetails. + The description you assign to the dynamic group. Does not have to be unique, and it's changeable. + + + :return: The description of this UpdateDynamicGroupDetails. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """ + Sets the description of this UpdateDynamicGroupDetails. + The description you assign to the dynamic group. Does not have to be unique, and it's changeable. + + + :param description: The description of this UpdateDynamicGroupDetails. + :type: str + """ + self._description = description + + @property + def matching_rule(self): + """ + Gets the matching_rule of this UpdateDynamicGroupDetails. + The matching rule to dynamically match an instance certificate to this dynamic group + + + :return: The matching_rule of this UpdateDynamicGroupDetails. + :rtype: str + """ + return self._matching_rule + + @matching_rule.setter + def matching_rule(self, matching_rule): + """ + Sets the matching_rule of this UpdateDynamicGroupDetails. + The matching rule to dynamically match an instance certificate to this dynamic group + + + :param matching_rule: The matching_rule of this UpdateDynamicGroupDetails. + :type: str + """ + self._matching_rule = matching_rule + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/identity/models/update_group_details.py b/src/oci/identity/models/update_group_details.py index 0e0dc2e3d7..027432ddc0 100644 --- a/src/oci/identity/models/update_group_details.py +++ b/src/oci/identity/models/update_group_details.py @@ -71,8 +71,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this UpdateGroupDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this UpdateGroupDetails. @@ -84,8 +87,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this UpdateGroupDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this UpdateGroupDetails. @@ -97,8 +103,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this UpdateGroupDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this UpdateGroupDetails. @@ -110,8 +119,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this UpdateGroupDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this UpdateGroupDetails. diff --git a/src/oci/identity/models/update_identity_provider_details.py b/src/oci/identity/models/update_identity_provider_details.py index 93d0b7789b..972400c32d 100644 --- a/src/oci/identity/models/update_identity_provider_details.py +++ b/src/oci/identity/models/update_identity_provider_details.py @@ -134,8 +134,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this UpdateIdentityProviderDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this UpdateIdentityProviderDetails. @@ -147,8 +150,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this UpdateIdentityProviderDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this UpdateIdentityProviderDetails. @@ -160,8 +166,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this UpdateIdentityProviderDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this UpdateIdentityProviderDetails. @@ -173,8 +182,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this UpdateIdentityProviderDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this UpdateIdentityProviderDetails. diff --git a/src/oci/identity/models/update_policy_details.py b/src/oci/identity/models/update_policy_details.py index 4962e9b5dc..23702c5aab 100644 --- a/src/oci/identity/models/update_policy_details.py +++ b/src/oci/identity/models/update_policy_details.py @@ -147,8 +147,11 @@ def version_date(self, version_date): def freeform_tags(self): """ Gets the freeform_tags of this UpdatePolicyDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this UpdatePolicyDetails. @@ -160,8 +163,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this UpdatePolicyDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this UpdatePolicyDetails. @@ -173,8 +179,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this UpdatePolicyDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this UpdatePolicyDetails. @@ -186,8 +195,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this UpdatePolicyDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this UpdatePolicyDetails. diff --git a/src/oci/identity/models/update_tag_details.py b/src/oci/identity/models/update_tag_details.py index fa5e58702c..a94b60bf70 100644 --- a/src/oci/identity/models/update_tag_details.py +++ b/src/oci/identity/models/update_tag_details.py @@ -54,7 +54,7 @@ def __init__(self, **kwargs): def description(self): """ Gets the description of this UpdateTagDetails. - The description of the tag. + The description you assign to the tag during creation. :return: The description of this UpdateTagDetails. @@ -66,7 +66,7 @@ def description(self): def description(self, description): """ Sets the description of this UpdateTagDetails. - The description of the tag. + The description you assign to the tag during creation. :param description: The description of this UpdateTagDetails. @@ -78,7 +78,10 @@ def description(self, description): def is_retired(self): """ Gets the is_retired of this UpdateTagDetails. - whether or not the tag is retired + Whether the tag is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :return: The is_retired of this UpdateTagDetails. @@ -90,7 +93,10 @@ def is_retired(self): def is_retired(self, is_retired): """ Sets the is_retired of this UpdateTagDetails. - whether or not the tag is retired + Whether the tag is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :param is_retired: The is_retired of this UpdateTagDetails. @@ -102,8 +108,11 @@ def is_retired(self, is_retired): def freeform_tags(self): """ Gets the freeform_tags of this UpdateTagDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this UpdateTagDetails. @@ -115,8 +124,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this UpdateTagDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this UpdateTagDetails. @@ -128,8 +140,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this UpdateTagDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this UpdateTagDetails. @@ -141,8 +156,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this UpdateTagDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this UpdateTagDetails. diff --git a/src/oci/identity/models/update_tag_namespace_details.py b/src/oci/identity/models/update_tag_namespace_details.py index 0ccee94ed6..3e67a631e5 100644 --- a/src/oci/identity/models/update_tag_namespace_details.py +++ b/src/oci/identity/models/update_tag_namespace_details.py @@ -54,7 +54,7 @@ def __init__(self, **kwargs): def description(self): """ Gets the description of this UpdateTagNamespaceDetails. - The description of the tagNamespace. + The description you assign to the tag namespace. :return: The description of this UpdateTagNamespaceDetails. @@ -66,7 +66,7 @@ def description(self): def description(self, description): """ Sets the description of this UpdateTagNamespaceDetails. - The description of the tagNamespace. + The description you assign to the tag namespace. :param description: The description of this UpdateTagNamespaceDetails. @@ -78,7 +78,10 @@ def description(self, description): def is_retired(self): """ Gets the is_retired of this UpdateTagNamespaceDetails. - whether or not the tagNamespace is retired + Whether the tag namespace is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :return: The is_retired of this UpdateTagNamespaceDetails. @@ -90,7 +93,10 @@ def is_retired(self): def is_retired(self, is_retired): """ Sets the is_retired of this UpdateTagNamespaceDetails. - whether or not the tagNamespace is retired + Whether the tag namespace is retired. + See `Retiring Key Definitions and Namespace Definitions`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm#Retiring :param is_retired: The is_retired of this UpdateTagNamespaceDetails. @@ -102,8 +108,11 @@ def is_retired(self, is_retired): def freeform_tags(self): """ Gets the freeform_tags of this UpdateTagNamespaceDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this UpdateTagNamespaceDetails. @@ -115,8 +124,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this UpdateTagNamespaceDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this UpdateTagNamespaceDetails. @@ -128,8 +140,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this UpdateTagNamespaceDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this UpdateTagNamespaceDetails. @@ -141,8 +156,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this UpdateTagNamespaceDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this UpdateTagNamespaceDetails. diff --git a/src/oci/identity/models/update_user_details.py b/src/oci/identity/models/update_user_details.py index e2613b5d11..382907bd50 100644 --- a/src/oci/identity/models/update_user_details.py +++ b/src/oci/identity/models/update_user_details.py @@ -71,8 +71,11 @@ def description(self, description): def freeform_tags(self): """ Gets the freeform_tags of this UpdateUserDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this UpdateUserDetails. @@ -84,8 +87,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this UpdateUserDetails. - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this UpdateUserDetails. @@ -97,8 +103,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this UpdateUserDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this UpdateUserDetails. @@ -110,8 +119,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this UpdateUserDetails. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this UpdateUserDetails. diff --git a/src/oci/identity/models/user.py b/src/oci/identity/models/user.py index 434923fa21..350f3dd0fe 100644 --- a/src/oci/identity/models/user.py +++ b/src/oci/identity/models/user.py @@ -283,9 +283,11 @@ def inactive_status(self, inactive_status): def freeform_tags(self): """ Gets the freeform_tags of this User. - Simple key-value pair that is applied without any predefined name, type or scope. Exists solely for - compatibility with other cloud provider tagging schemes. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The freeform_tags of this User. @@ -297,9 +299,11 @@ def freeform_tags(self): def freeform_tags(self, freeform_tags): """ Sets the freeform_tags of this User. - Simple key-value pair that is applied without any predefined name, type or scope. Exists solely for - compatibility with other cloud provider tagging schemes. - Example: `{\"bar-key\": \"value\"}` + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param freeform_tags: The freeform_tags of this User. @@ -311,8 +315,11 @@ def freeform_tags(self, freeform_tags): def defined_tags(self): """ Gets the defined_tags of this User. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :return: The defined_tags of this User. @@ -324,8 +331,11 @@ def defined_tags(self): def defined_tags(self, defined_tags): """ Sets the defined_tags of this User. - Usage of predefined tag keys. These predefined keys are scoped to namespaces. - Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}` + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm :param defined_tags: The defined_tags of this User. diff --git a/src/oci/load_balancer/load_balancer_client.py b/src/oci/load_balancer/load_balancer_client.py index 98a364355a..34889e4687 100644 --- a/src/oci/load_balancer/load_balancer_client.py +++ b/src/oci/load_balancer/load_balancer_client.py @@ -3,8 +3,10 @@ from __future__ import absolute_import +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -15,16 +17,19 @@ class LoadBalancerClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("load_balancer", config, signer, load_balancer_type_mapping) def create_backend(self, create_backend_details, load_balancer_id, backend_set_name, **kwargs): @@ -65,6 +70,7 @@ def create_backend(self, create_backend_details, load_balancer_id, backend_set_n # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -92,12 +98,23 @@ def create_backend(self, create_backend_details, load_balancer_id, backend_set_n } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_backend_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_backend_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_backend_details) def create_backend_set(self, create_backend_set_details, load_balancer_id, **kwargs): """ @@ -132,6 +149,7 @@ def create_backend_set(self, create_backend_set_details, load_balancer_id, **kwa # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -158,12 +176,23 @@ def create_backend_set(self, create_backend_set_details, load_balancer_id, **kwa } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_backend_set_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_backend_set_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_backend_set_details) def create_certificate(self, create_certificate_details, load_balancer_id, **kwargs): """ @@ -198,6 +227,7 @@ def create_certificate(self, create_certificate_details, load_balancer_id, **kwa # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -224,12 +254,23 @@ def create_certificate(self, create_certificate_details, load_balancer_id, **kwa } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_certificate_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_certificate_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_certificate_details) def create_listener(self, create_listener_details, load_balancer_id, **kwargs): """ @@ -264,6 +305,7 @@ def create_listener(self, create_listener_details, load_balancer_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -290,12 +332,23 @@ def create_listener(self, create_listener_details, load_balancer_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_listener_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_listener_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_listener_details) def create_load_balancer(self, create_load_balancer_details, **kwargs): """ @@ -356,6 +409,7 @@ def create_load_balancer(self, create_load_balancer_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -372,11 +426,21 @@ def create_load_balancer(self, create_load_balancer_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - body=create_load_balancer_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_load_balancer_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_load_balancer_details) def delete_backend(self, load_balancer_id, backend_set_name, backend_name, **kwargs): """ @@ -411,6 +475,7 @@ def delete_backend(self, load_balancer_id, backend_set_name, backend_name, **kwa # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -437,11 +502,19 @@ def delete_backend(self, load_balancer_id, backend_set_name, backend_name, **kwa } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_backend_set(self, load_balancer_id, backend_set_name, **kwargs): """ @@ -473,6 +546,7 @@ def delete_backend_set(self, load_balancer_id, backend_set_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -498,11 +572,19 @@ def delete_backend_set(self, load_balancer_id, backend_set_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_certificate(self, load_balancer_id, certificate_name, **kwargs): """ @@ -532,6 +614,7 @@ def delete_certificate(self, load_balancer_id, certificate_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -557,11 +640,19 @@ def delete_certificate(self, load_balancer_id, certificate_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_listener(self, load_balancer_id, listener_name, **kwargs): """ @@ -591,6 +682,7 @@ def delete_listener(self, load_balancer_id, listener_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -616,11 +708,19 @@ def delete_listener(self, load_balancer_id, listener_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_load_balancer(self, load_balancer_id, **kwargs): """ @@ -645,6 +745,7 @@ def delete_load_balancer(self, load_balancer_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -669,11 +770,19 @@ def delete_load_balancer(self, load_balancer_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def get_backend(self, load_balancer_id, backend_set_name, backend_name, **kwargs): """ @@ -708,6 +817,7 @@ def get_backend(self, load_balancer_id, backend_set_name, backend_name, **kwargs # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -734,12 +844,21 @@ def get_backend(self, load_balancer_id, backend_set_name, backend_name, **kwargs } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Backend") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Backend") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Backend") def get_backend_health(self, load_balancer_id, backend_set_name, backend_name, **kwargs): """ @@ -774,6 +893,7 @@ def get_backend_health(self, load_balancer_id, backend_set_name, backend_name, * # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -800,12 +920,21 @@ def get_backend_health(self, load_balancer_id, backend_set_name, backend_name, * } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="BackendHealth") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BackendHealth") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BackendHealth") def get_backend_set(self, load_balancer_id, backend_set_name, **kwargs): """ @@ -835,6 +964,7 @@ def get_backend_set(self, load_balancer_id, backend_set_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -860,12 +990,21 @@ def get_backend_set(self, load_balancer_id, backend_set_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="BackendSet") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BackendSet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BackendSet") def get_backend_set_health(self, load_balancer_id, backend_set_name, **kwargs): """ @@ -895,6 +1034,7 @@ def get_backend_set_health(self, load_balancer_id, backend_set_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -920,12 +1060,21 @@ def get_backend_set_health(self, load_balancer_id, backend_set_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="BackendSetHealth") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BackendSetHealth") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="BackendSetHealth") def get_health_checker(self, load_balancer_id, backend_set_name, **kwargs): """ @@ -955,6 +1104,7 @@ def get_health_checker(self, load_balancer_id, backend_set_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -980,12 +1130,21 @@ def get_health_checker(self, load_balancer_id, backend_set_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="HealthChecker") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="HealthChecker") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="HealthChecker") def get_load_balancer(self, load_balancer_id, **kwargs): """ @@ -1010,6 +1169,7 @@ def get_load_balancer(self, load_balancer_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1034,12 +1194,21 @@ def get_load_balancer(self, load_balancer_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="LoadBalancer") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LoadBalancer") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LoadBalancer") def get_load_balancer_health(self, load_balancer_id, **kwargs): """ @@ -1064,6 +1233,7 @@ def get_load_balancer_health(self, load_balancer_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1088,12 +1258,21 @@ def get_load_balancer_health(self, load_balancer_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="LoadBalancerHealth") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LoadBalancerHealth") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="LoadBalancerHealth") def get_work_request(self, work_request_id, **kwargs): """ @@ -1118,6 +1297,7 @@ def get_work_request(self, work_request_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1142,12 +1322,21 @@ def get_work_request(self, work_request_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="WorkRequest") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="WorkRequest") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="WorkRequest") def list_backend_sets(self, load_balancer_id, **kwargs): """ @@ -1172,6 +1361,7 @@ def list_backend_sets(self, load_balancer_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1196,12 +1386,21 @@ def list_backend_sets(self, load_balancer_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="list[BackendSet]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[BackendSet]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[BackendSet]") def list_backends(self, load_balancer_id, backend_set_name, **kwargs): """ @@ -1231,6 +1430,7 @@ def list_backends(self, load_balancer_id, backend_set_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1256,12 +1456,21 @@ def list_backends(self, load_balancer_id, backend_set_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="list[Backend]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[Backend]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[Backend]") def list_certificates(self, load_balancer_id, **kwargs): """ @@ -1286,6 +1495,7 @@ def list_certificates(self, load_balancer_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1310,12 +1520,21 @@ def list_certificates(self, load_balancer_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="list[Certificate]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[Certificate]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[Certificate]") def list_load_balancer_healths(self, compartment_id, **kwargs): """ @@ -1350,6 +1569,7 @@ def list_load_balancer_healths(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "limit", "page" @@ -1373,12 +1593,21 @@ def list_load_balancer_healths(self, compartment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[LoadBalancerHealthSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerHealthSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerHealthSummary]") def list_load_balancers(self, compartment_id, **kwargs): """ @@ -1411,20 +1640,21 @@ def list_load_balancers(self, compartment_id, **kwargs): Example: `full` :param str sort_by: (optional) - The field to sort by. Only one sort order may be provided. Time created is default ordered as descending. Display name is default ordered as ascending. + The field to sort by. You can provide one sort order (`sortOrder`). Default order for TIMECREATED is descending. + Default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive. Allowed values are: "TIMECREATED", "DISPLAYNAME" :param str sort_order: (optional) - The sort order to use, either 'asc' or 'desc' + The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order is case sensitive. Allowed values are: "ASC", "DESC" :param str display_name: (optional) - A filter to only return resources that match the given display name exactly. + A filter to return only resources that match the given display name exactly. :param str lifecycle_state: (optional) - A filter to only return resources that match the given lifecycle state. + A filter to return only resources that match the given lifecycle state. Allowed values are: "CREATING", "FAILED", "ACTIVE", "DELETING", "DELETED" @@ -1436,6 +1666,7 @@ def list_load_balancers(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "limit", "page", @@ -1490,12 +1721,21 @@ def list_load_balancers(self, compartment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[LoadBalancer]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancer]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancer]") def list_policies(self, compartment_id, **kwargs): """ @@ -1530,6 +1770,7 @@ def list_policies(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "limit", "page" @@ -1553,12 +1794,21 @@ def list_policies(self, compartment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[LoadBalancerPolicy]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerPolicy]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerPolicy]") def list_protocols(self, compartment_id, **kwargs): """ @@ -1593,6 +1843,7 @@ def list_protocols(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "limit", "page" @@ -1616,12 +1867,21 @@ def list_protocols(self, compartment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[LoadBalancerProtocol]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerProtocol]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerProtocol]") def list_shapes(self, compartment_id, **kwargs): """ @@ -1656,6 +1916,7 @@ def list_shapes(self, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "limit", "page" @@ -1679,12 +1940,21 @@ def list_shapes(self, compartment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - query_params=query_params, - header_params=header_params, - response_type="list[LoadBalancerShape]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerShape]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[LoadBalancerShape]") def list_work_requests(self, load_balancer_id, **kwargs): """ @@ -1719,6 +1989,7 @@ def list_work_requests(self, load_balancer_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "limit", "page" @@ -1751,13 +2022,23 @@ def list_work_requests(self, load_balancer_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[WorkRequest]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[WorkRequest]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[WorkRequest]") def update_backend(self, update_backend_details, load_balancer_id, backend_set_name, backend_name, **kwargs): """ @@ -1802,6 +2083,7 @@ def update_backend(self, update_backend_details, load_balancer_id, backend_set_n # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -1830,12 +2112,23 @@ def update_backend(self, update_backend_details, load_balancer_id, backend_set_n } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_backend_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_backend_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_backend_details) def update_backend_set(self, update_backend_set_details, load_balancer_id, backend_set_name, **kwargs): """ @@ -1875,6 +2168,7 @@ def update_backend_set(self, update_backend_set_details, load_balancer_id, backe # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -1902,12 +2196,23 @@ def update_backend_set(self, update_backend_set_details, load_balancer_id, backe } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_backend_set_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_backend_set_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_backend_set_details) def update_health_checker(self, health_checker, load_balancer_id, backend_set_name, **kwargs): """ @@ -1947,6 +2252,7 @@ def update_health_checker(self, health_checker, load_balancer_id, backend_set_na # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -1974,12 +2280,23 @@ def update_health_checker(self, health_checker, load_balancer_id, backend_set_na } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=health_checker) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=health_checker) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=health_checker) def update_listener(self, update_listener_details, load_balancer_id, listener_name, **kwargs): """ @@ -2019,6 +2336,7 @@ def update_listener(self, update_listener_details, load_balancer_id, listener_na # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -2046,12 +2364,23 @@ def update_listener(self, update_listener_details, load_balancer_id, listener_na } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_listener_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_listener_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_listener_details) def update_load_balancer(self, update_load_balancer_details, load_balancer_id, **kwargs): """ @@ -2086,6 +2415,7 @@ def update_load_balancer(self, update_load_balancer_details, load_balancer_id, * # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_request_id", "opc_retry_token" ] @@ -2112,9 +2442,20 @@ def update_load_balancer(self, update_load_balancer_details, load_balancer_id, * } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_load_balancer_details) + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_load_balancer_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_load_balancer_details) diff --git a/src/oci/load_balancer/models/__init__.py b/src/oci/load_balancer/models/__init__.py index 74d76ca412..dfb0879017 100644 --- a/src/oci/load_balancer/models/__init__.py +++ b/src/oci/load_balancer/models/__init__.py @@ -11,6 +11,7 @@ from .backend_set_health import BackendSetHealth from .certificate import Certificate from .certificate_details import CertificateDetails +from .connection_configuration import ConnectionConfiguration from .create_backend_details import CreateBackendDetails from .create_backend_set_details import CreateBackendSetDetails from .create_certificate_details import CreateCertificateDetails @@ -49,6 +50,7 @@ "BackendSetHealth": BackendSetHealth, "Certificate": Certificate, "CertificateDetails": CertificateDetails, + "ConnectionConfiguration": ConnectionConfiguration, "CreateBackendDetails": CreateBackendDetails, "CreateBackendSetDetails": CreateBackendSetDetails, "CreateCertificateDetails": CreateCertificateDetails, diff --git a/src/oci/load_balancer/models/connection_configuration.py b/src/oci/load_balancer/models/connection_configuration.py new file mode 100644 index 0000000000..632ec60122 --- /dev/null +++ b/src/oci/load_balancer/models/connection_configuration.py @@ -0,0 +1,136 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class ConnectionConfiguration(object): + + def __init__(self, **kwargs): + """ + Initializes a new ConnectionConfiguration object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param idle_timeout: + The value to assign to the idle_timeout property of this ConnectionConfiguration. + :type idle_timeout: int + + """ + self.swagger_types = { + 'idle_timeout': 'int' + } + + self.attribute_map = { + 'idle_timeout': 'idleTimeout' + } + + self._idle_timeout = None + + @property + def idle_timeout(self): + """ + **[Required]** Gets the idle_timeout of this ConnectionConfiguration. + The maximum idle time, in seconds, allowed between two successive receive or two successive send operations + between the client and backend servers. A send operation does not reset the timer for receive operations. A + receive operation does not reset the timer for send operations. + + The default values are: + + * 300 seconds for TCP + + * 60 seconds for HTTP and WebSocket protocols. + + Note: The protocol is set at the listener. + + Modify this parameter if the client or backend server stops transmitting data for more than the default time. + Some examples include: + + * The client sends a database query to the backend server and the database takes over 300 seconds to execute. + Therefore, the backend server does not transmit any data within 300 seconds. + + * The client uploads data using the HTTP protocol. During the upload, the backend does not transmit any data + to the client for more than 60 seconds. + + * The client downloads data using the HTTP protocol. After the initial request, it stops transmitting data to + the backend server for more than 60 seconds. + + * The client starts transmitting data after establishing a WebSocket connection, but the backend server does + not transmit data for more than 60 seconds. + + * The backend server starts transmitting data after establishing a WebSocket connection, but the client does + not transmit data for more than 60 seconds. + + The maximum value is 7200 seconds. Contact My Oracle Support to file a service request if you want to increase + this limit for your tenancy. For more information, see `Service Limits`__. + + Example: `1200` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/servicelimits.htm + + + :return: The idle_timeout of this ConnectionConfiguration. + :rtype: int + """ + return self._idle_timeout + + @idle_timeout.setter + def idle_timeout(self, idle_timeout): + """ + Sets the idle_timeout of this ConnectionConfiguration. + The maximum idle time, in seconds, allowed between two successive receive or two successive send operations + between the client and backend servers. A send operation does not reset the timer for receive operations. A + receive operation does not reset the timer for send operations. + + The default values are: + + * 300 seconds for TCP + + * 60 seconds for HTTP and WebSocket protocols. + + Note: The protocol is set at the listener. + + Modify this parameter if the client or backend server stops transmitting data for more than the default time. + Some examples include: + + * The client sends a database query to the backend server and the database takes over 300 seconds to execute. + Therefore, the backend server does not transmit any data within 300 seconds. + + * The client uploads data using the HTTP protocol. During the upload, the backend does not transmit any data + to the client for more than 60 seconds. + + * The client downloads data using the HTTP protocol. After the initial request, it stops transmitting data to + the backend server for more than 60 seconds. + + * The client starts transmitting data after establishing a WebSocket connection, but the backend server does + not transmit data for more than 60 seconds. + + * The backend server starts transmitting data after establishing a WebSocket connection, but the client does + not transmit data for more than 60 seconds. + + The maximum value is 7200 seconds. Contact My Oracle Support to file a service request if you want to increase + this limit for your tenancy. For more information, see `Service Limits`__. + + Example: `1200` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/servicelimits.htm + + + :param idle_timeout: The idle_timeout of this ConnectionConfiguration. + :type: int + """ + self._idle_timeout = idle_timeout + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/load_balancer/models/create_listener_details.py b/src/oci/load_balancer/models/create_listener_details.py index 48af7a98cb..722f98d37e 100644 --- a/src/oci/load_balancer/models/create_listener_details.py +++ b/src/oci/load_balancer/models/create_listener_details.py @@ -14,6 +14,10 @@ def __init__(self, **kwargs): Initializes a new CreateListenerDetails object with values from values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class): + :param connection_configuration: + The value to assign to the connection_configuration property of this CreateListenerDetails. + :type connection_configuration: ConnectionConfiguration + :param default_backend_set_name: The value to assign to the default_backend_set_name property of this CreateListenerDetails. :type default_backend_set_name: str @@ -36,6 +40,7 @@ def __init__(self, **kwargs): """ self.swagger_types = { + 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', 'name': 'str', 'port': 'int', @@ -44,6 +49,7 @@ def __init__(self, **kwargs): } self.attribute_map = { + 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', 'name': 'name', 'port': 'port', @@ -51,18 +57,41 @@ def __init__(self, **kwargs): 'ssl_configuration': 'sslConfiguration' } + self._connection_configuration = None self._default_backend_set_name = None self._name = None self._port = None self._protocol = None self._ssl_configuration = None + @property + def connection_configuration(self): + """ + Gets the connection_configuration of this CreateListenerDetails. + + :return: The connection_configuration of this CreateListenerDetails. + :rtype: ConnectionConfiguration + """ + return self._connection_configuration + + @connection_configuration.setter + def connection_configuration(self, connection_configuration): + """ + Sets the connection_configuration of this CreateListenerDetails. + + :param connection_configuration: The connection_configuration of this CreateListenerDetails. + :type: ConnectionConfiguration + """ + self._connection_configuration = connection_configuration + @property def default_backend_set_name(self): """ **[Required]** Gets the default_backend_set_name of this CreateListenerDetails. The name of the associated backend set. + Example: `My_backend_set` + :return: The default_backend_set_name of this CreateListenerDetails. :rtype: str @@ -75,6 +104,8 @@ def default_backend_set_name(self, default_backend_set_name): Sets the default_backend_set_name of this CreateListenerDetails. The name of the associated backend set. + Example: `My_backend_set` + :param default_backend_set_name: The default_backend_set_name of this CreateListenerDetails. :type: str diff --git a/src/oci/load_balancer/models/listener.py b/src/oci/load_balancer/models/listener.py index e0e2be3c7e..a177c421ea 100644 --- a/src/oci/load_balancer/models/listener.py +++ b/src/oci/load_balancer/models/listener.py @@ -14,6 +14,10 @@ def __init__(self, **kwargs): Initializes a new Listener object with values from values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class): + :param connection_configuration: + The value to assign to the connection_configuration property of this Listener. + :type connection_configuration: ConnectionConfiguration + :param default_backend_set_name: The value to assign to the default_backend_set_name property of this Listener. :type default_backend_set_name: str @@ -36,6 +40,7 @@ def __init__(self, **kwargs): """ self.swagger_types = { + 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', 'name': 'str', 'port': 'int', @@ -44,6 +49,7 @@ def __init__(self, **kwargs): } self.attribute_map = { + 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', 'name': 'name', 'port': 'port', @@ -51,18 +57,41 @@ def __init__(self, **kwargs): 'ssl_configuration': 'sslConfiguration' } + self._connection_configuration = None self._default_backend_set_name = None self._name = None self._port = None self._protocol = None self._ssl_configuration = None + @property + def connection_configuration(self): + """ + Gets the connection_configuration of this Listener. + + :return: The connection_configuration of this Listener. + :rtype: ConnectionConfiguration + """ + return self._connection_configuration + + @connection_configuration.setter + def connection_configuration(self, connection_configuration): + """ + Sets the connection_configuration of this Listener. + + :param connection_configuration: The connection_configuration of this Listener. + :type: ConnectionConfiguration + """ + self._connection_configuration = connection_configuration + @property def default_backend_set_name(self): """ **[Required]** Gets the default_backend_set_name of this Listener. The name of the associated backend set. + Example: `My_backend_set` + :return: The default_backend_set_name of this Listener. :rtype: str @@ -75,6 +104,8 @@ def default_backend_set_name(self, default_backend_set_name): Sets the default_backend_set_name of this Listener. The name of the associated backend set. + Example: `My_backend_set` + :param default_backend_set_name: The default_backend_set_name of this Listener. :type: str diff --git a/src/oci/load_balancer/models/listener_details.py b/src/oci/load_balancer/models/listener_details.py index 605e6e47b7..2788ad1254 100644 --- a/src/oci/load_balancer/models/listener_details.py +++ b/src/oci/load_balancer/models/listener_details.py @@ -14,6 +14,10 @@ def __init__(self, **kwargs): Initializes a new ListenerDetails object with values from values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class): + :param connection_configuration: + The value to assign to the connection_configuration property of this ListenerDetails. + :type connection_configuration: ConnectionConfiguration + :param default_backend_set_name: The value to assign to the default_backend_set_name property of this ListenerDetails. :type default_backend_set_name: str @@ -32,6 +36,7 @@ def __init__(self, **kwargs): """ self.swagger_types = { + 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', 'port': 'int', 'protocol': 'str', @@ -39,23 +44,47 @@ def __init__(self, **kwargs): } self.attribute_map = { + 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', 'port': 'port', 'protocol': 'protocol', 'ssl_configuration': 'sslConfiguration' } + self._connection_configuration = None self._default_backend_set_name = None self._port = None self._protocol = None self._ssl_configuration = None + @property + def connection_configuration(self): + """ + Gets the connection_configuration of this ListenerDetails. + + :return: The connection_configuration of this ListenerDetails. + :rtype: ConnectionConfiguration + """ + return self._connection_configuration + + @connection_configuration.setter + def connection_configuration(self, connection_configuration): + """ + Sets the connection_configuration of this ListenerDetails. + + :param connection_configuration: The connection_configuration of this ListenerDetails. + :type: ConnectionConfiguration + """ + self._connection_configuration = connection_configuration + @property def default_backend_set_name(self): """ **[Required]** Gets the default_backend_set_name of this ListenerDetails. The name of the associated backend set. + Example: `My_backend_set` + :return: The default_backend_set_name of this ListenerDetails. :rtype: str @@ -68,6 +97,8 @@ def default_backend_set_name(self, default_backend_set_name): Sets the default_backend_set_name of this ListenerDetails. The name of the associated backend set. + Example: `My_backend_set` + :param default_backend_set_name: The default_backend_set_name of this ListenerDetails. :type: str diff --git a/src/oci/load_balancer/models/update_listener_details.py b/src/oci/load_balancer/models/update_listener_details.py index 32a7ce7842..d09436e428 100644 --- a/src/oci/load_balancer/models/update_listener_details.py +++ b/src/oci/load_balancer/models/update_listener_details.py @@ -14,6 +14,10 @@ def __init__(self, **kwargs): Initializes a new UpdateListenerDetails object with values from values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class): + :param connection_configuration: + The value to assign to the connection_configuration property of this UpdateListenerDetails. + :type connection_configuration: ConnectionConfiguration + :param default_backend_set_name: The value to assign to the default_backend_set_name property of this UpdateListenerDetails. :type default_backend_set_name: str @@ -32,6 +36,7 @@ def __init__(self, **kwargs): """ self.swagger_types = { + 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', 'port': 'int', 'protocol': 'str', @@ -39,23 +44,47 @@ def __init__(self, **kwargs): } self.attribute_map = { + 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', 'port': 'port', 'protocol': 'protocol', 'ssl_configuration': 'sslConfiguration' } + self._connection_configuration = None self._default_backend_set_name = None self._port = None self._protocol = None self._ssl_configuration = None + @property + def connection_configuration(self): + """ + Gets the connection_configuration of this UpdateListenerDetails. + + :return: The connection_configuration of this UpdateListenerDetails. + :rtype: ConnectionConfiguration + """ + return self._connection_configuration + + @connection_configuration.setter + def connection_configuration(self, connection_configuration): + """ + Sets the connection_configuration of this UpdateListenerDetails. + + :param connection_configuration: The connection_configuration of this UpdateListenerDetails. + :type: ConnectionConfiguration + """ + self._connection_configuration = connection_configuration + @property def default_backend_set_name(self): """ **[Required]** Gets the default_backend_set_name of this UpdateListenerDetails. The name of the associated backend set. + Example: `My_backend_set` + :return: The default_backend_set_name of this UpdateListenerDetails. :rtype: str @@ -68,6 +97,8 @@ def default_backend_set_name(self, default_backend_set_name): Sets the default_backend_set_name of this UpdateListenerDetails. The name of the associated backend set. + Example: `My_backend_set` + :param default_backend_set_name: The default_backend_set_name of this UpdateListenerDetails. :type: str diff --git a/src/oci/object_storage/models/bucket.py b/src/oci/object_storage/models/bucket.py index 521b9e57e5..55f78e157a 100644 --- a/src/oci/object_storage/models/bucket.py +++ b/src/oci/object_storage/models/bucket.py @@ -44,7 +44,7 @@ def __init__(self, **kwargs): :param public_access_type: The value to assign to the public_access_type property of this Bucket. - Allowed values for this property are: "NoPublicAccess", "ObjectRead", 'UNKNOWN_ENUM_VALUE'. + Allowed values for this property are: "NoPublicAccess", "ObjectRead", "ObjectReadWithoutList", 'UNKNOWN_ENUM_VALUE'. Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. :type public_access_type: str @@ -270,9 +270,10 @@ def public_access_type(self): The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access is allowed for the - `GetObject`, `HeadObject`, and `ListObjects` operations. + `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled on the + bucket, public access is allowed for the `GetObject` and `HeadObject` operations. - Allowed values for this property are: "NoPublicAccess", "ObjectRead", 'UNKNOWN_ENUM_VALUE'. + Allowed values for this property are: "NoPublicAccess", "ObjectRead", "ObjectReadWithoutList", 'UNKNOWN_ENUM_VALUE'. Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. @@ -288,13 +289,14 @@ def public_access_type(self, public_access_type): The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access is allowed for the - `GetObject`, `HeadObject`, and `ListObjects` operations. + `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled on the + bucket, public access is allowed for the `GetObject` and `HeadObject` operations. :param public_access_type: The public_access_type of this Bucket. :type: str """ - allowed_values = ["NoPublicAccess", "ObjectRead"] + allowed_values = ["NoPublicAccess", "ObjectRead", "ObjectReadWithoutList"] if not value_allowed_none_or_none_sentinel(public_access_type, allowed_values): public_access_type = 'UNKNOWN_ENUM_VALUE' self._public_access_type = public_access_type diff --git a/src/oci/object_storage/models/create_bucket_details.py b/src/oci/object_storage/models/create_bucket_details.py index 1d270fb666..b6487cdbb1 100644 --- a/src/oci/object_storage/models/create_bucket_details.py +++ b/src/oci/object_storage/models/create_bucket_details.py @@ -28,7 +28,7 @@ def __init__(self, **kwargs): :param public_access_type: The value to assign to the public_access_type property of this CreateBucketDetails. - Allowed values for this property are: "NoPublicAccess", "ObjectRead" + Allowed values for this property are: "NoPublicAccess", "ObjectRead", "ObjectReadWithoutList" :type public_access_type: str :param storage_tier: @@ -142,9 +142,10 @@ def public_access_type(self): The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access is allowed for the - `GetObject`, `HeadObject`, and `ListObjects` operations. + `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled on the bucket, + public access is allowed for the `GetObject` and `HeadObject` operations. - Allowed values for this property are: "NoPublicAccess", "ObjectRead" + Allowed values for this property are: "NoPublicAccess", "ObjectRead", "ObjectReadWithoutList" :return: The public_access_type of this CreateBucketDetails. @@ -159,13 +160,14 @@ def public_access_type(self, public_access_type): The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access is allowed for the - `GetObject`, `HeadObject`, and `ListObjects` operations. + `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled on the bucket, + public access is allowed for the `GetObject` and `HeadObject` operations. :param public_access_type: The public_access_type of this CreateBucketDetails. :type: str """ - allowed_values = ["NoPublicAccess", "ObjectRead"] + allowed_values = ["NoPublicAccess", "ObjectRead", "ObjectReadWithoutList"] if not value_allowed_none_or_none_sentinel(public_access_type, allowed_values): raise ValueError( "Invalid value for `public_access_type`, must be None or one of {0}" diff --git a/src/oci/object_storage/models/update_bucket_details.py b/src/oci/object_storage/models/update_bucket_details.py index 3e1013cfba..01ea009e1f 100644 --- a/src/oci/object_storage/models/update_bucket_details.py +++ b/src/oci/object_storage/models/update_bucket_details.py @@ -32,7 +32,7 @@ def __init__(self, **kwargs): :param public_access_type: The value to assign to the public_access_type property of this UpdateBucketDetails. - Allowed values for this property are: "NoPublicAccess", "ObjectRead" + Allowed values for this property are: "NoPublicAccess", "ObjectRead", "ObjectReadWithoutList" :type public_access_type: str """ @@ -162,9 +162,10 @@ def public_access_type(self): Gets the public_access_type of this UpdateBucketDetails. The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access - is allowed for the `GetObject`, `HeadObject`, and `ListObjects` operations. + is allowed for the `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled + on the bucket, public access is allowed for the `GetObject` and `HeadObject` operations. - Allowed values for this property are: "NoPublicAccess", "ObjectRead" + Allowed values for this property are: "NoPublicAccess", "ObjectRead", "ObjectReadWithoutList" :return: The public_access_type of this UpdateBucketDetails. @@ -178,13 +179,14 @@ def public_access_type(self, public_access_type): Sets the public_access_type of this UpdateBucketDetails. The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess` by default, which only allows an authenticated caller to access the bucket and its contents. When `ObjectRead` is enabled on the bucket, public access - is allowed for the `GetObject`, `HeadObject`, and `ListObjects` operations. + is allowed for the `GetObject`, `HeadObject`, and `ListObjects` operations. When `ObjectReadWithoutList` is enabled + on the bucket, public access is allowed for the `GetObject` and `HeadObject` operations. :param public_access_type: The public_access_type of this UpdateBucketDetails. :type: str """ - allowed_values = ["NoPublicAccess", "ObjectRead"] + allowed_values = ["NoPublicAccess", "ObjectRead", "ObjectReadWithoutList"] if not value_allowed_none_or_none_sentinel(public_access_type, allowed_values): raise ValueError( "Invalid value for `public_access_type`, must be None or one of {0}" diff --git a/src/oci/object_storage/object_storage_client.py b/src/oci/object_storage/object_storage_client.py index 0c8eba44b5..b900b27c24 100644 --- a/src/oci/object_storage/object_storage_client.py +++ b/src/oci/object_storage/object_storage_client.py @@ -3,9 +3,10 @@ from __future__ import absolute_import -import requests +import requests # noqa: F401 import six +from .. import retry # noqa: F401 from ..base_client import BaseClient from ..config import get_config_value_or_default, validate_config from ..signer import Signer @@ -16,16 +17,19 @@ class ObjectStorageClient(object): - def __init__(self, config): - validate_config(config) - signer = Signer( - tenancy=config["tenancy"], - user=config["user"], - fingerprint=config["fingerprint"], - private_key_file_location=config.get("key_file"), - pass_phrase=get_config_value_or_default(config, "pass_phrase"), - private_key_content=config.get("key_content") - ) + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) self.base_client = BaseClient("object_storage", config, signer, object_storage_type_mapping) def abort_multipart_upload(self, namespace_name, bucket_name, object_name, upload_id, **kwargs): @@ -59,6 +63,7 @@ def abort_multipart_upload(self, namespace_name, bucket_name, object_name, uploa # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -90,12 +95,21 @@ def abort_multipart_upload(self, namespace_name, bucket_name, object_name, uploa } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) def commit_multipart_upload(self, namespace_name, bucket_name, object_name, upload_id, commit_multipart_upload_details, **kwargs): """ @@ -139,6 +153,7 @@ def commit_multipart_upload(self, namespace_name, bucket_name, object_name, uplo # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "if_none_match", "opc_client_request_id" @@ -174,13 +189,23 @@ def commit_multipart_upload(self, namespace_name, bucket_name, object_name, uplo } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - body=commit_multipart_upload_details) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=commit_multipart_upload_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=commit_multipart_upload_details) def create_bucket(self, namespace_name, create_bucket_details, **kwargs): """ @@ -205,6 +230,7 @@ def create_bucket(self, namespace_name, create_bucket_details, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -229,13 +255,23 @@ def create_bucket(self, namespace_name, create_bucket_details, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_bucket_details, - response_type="Bucket") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_bucket_details, + response_type="Bucket") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_bucket_details, + response_type="Bucket") def create_multipart_upload(self, namespace_name, bucket_name, create_multipart_upload_details, **kwargs): """ @@ -272,6 +308,7 @@ def create_multipart_upload(self, namespace_name, bucket_name, create_multipart_ # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "if_none_match", "opc_client_request_id" @@ -301,13 +338,23 @@ def create_multipart_upload(self, namespace_name, bucket_name, create_multipart_ } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_multipart_upload_details, - response_type="MultipartUpload") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_multipart_upload_details, + response_type="MultipartUpload") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_multipart_upload_details, + response_type="MultipartUpload") def create_preauthenticated_request(self, namespace_name, bucket_name, create_preauthenticated_request_details, **kwargs): """ @@ -336,6 +383,7 @@ def create_preauthenticated_request(self, namespace_name, bucket_name, create_pr # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -361,13 +409,23 @@ def create_preauthenticated_request(self, namespace_name, bucket_name, create_pr } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=create_preauthenticated_request_details, - response_type="PreauthenticatedRequest") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_preauthenticated_request_details, + response_type="PreauthenticatedRequest") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_preauthenticated_request_details, + response_type="PreauthenticatedRequest") def delete_bucket(self, namespace_name, bucket_name, **kwargs): """ @@ -397,6 +455,7 @@ def delete_bucket(self, namespace_name, bucket_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "opc_client_request_id" ] @@ -424,11 +483,19 @@ def delete_bucket(self, namespace_name, bucket_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_object(self, namespace_name, bucket_name, object_name, **kwargs): """ @@ -462,6 +529,7 @@ def delete_object(self, namespace_name, bucket_name, object_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "opc_client_request_id" ] @@ -490,11 +558,19 @@ def delete_object(self, namespace_name, bucket_name, object_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def delete_preauthenticated_request(self, namespace_name, bucket_name, par_id, **kwargs): """ @@ -524,6 +600,7 @@ def delete_preauthenticated_request(self, namespace_name, bucket_name, par_id, * # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -550,11 +627,19 @@ def delete_preauthenticated_request(self, namespace_name, bucket_name, par_id, * } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def get_bucket(self, namespace_name, bucket_name, **kwargs): """ @@ -588,6 +673,7 @@ def get_bucket(self, namespace_name, bucket_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "if_none_match", "opc_client_request_id" @@ -617,18 +703,27 @@ def get_bucket(self, namespace_name, bucket_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="Bucket") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Bucket") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Bucket") def get_namespace(self, **kwargs): """ GET Namespace Name - Gets the name of the namespace for the user making the request. An account name must be unique, must start with a - letter, and can have up to 15 lowercase letters and numbers. You cannot use spaces or special characters. + Namespaces are unique. Namespaces are either the tenancy name or a random string automatically generated during + account creation. You cannot edit a namespace. :param str opc_client_request_id: (optional) @@ -642,6 +737,7 @@ def get_namespace(self, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -656,11 +752,19 @@ def get_namespace(self, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - header_params=header_params, - response_type="str") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + response_type="str") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + response_type="str") def get_namespace_metadata(self, namespace_name, **kwargs): """ @@ -687,6 +791,7 @@ def get_namespace_metadata(self, namespace_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -711,12 +816,21 @@ def get_namespace_metadata(self, namespace_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="NamespaceMetadata") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="NamespaceMetadata") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="NamespaceMetadata") def get_object(self, namespace_name, bucket_name, object_name, **kwargs): """ @@ -760,6 +874,7 @@ def get_object(self, namespace_name, bucket_name, object_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "if_none_match", "opc_client_request_id", @@ -792,12 +907,21 @@ def get_object(self, namespace_name, bucket_name, object_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="stream") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="stream") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="stream") def get_preauthenticated_request(self, namespace_name, bucket_name, par_id, **kwargs): """ @@ -827,6 +951,7 @@ def get_preauthenticated_request(self, namespace_name, bucket_name, par_id, **kw # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -853,12 +978,21 @@ def get_preauthenticated_request(self, namespace_name, bucket_name, par_id, **kw } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - response_type="PreauthenticatedRequestSummary") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PreauthenticatedRequestSummary") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PreauthenticatedRequestSummary") def head_bucket(self, namespace_name, bucket_name, **kwargs): """ @@ -892,6 +1026,7 @@ def head_bucket(self, namespace_name, bucket_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "if_none_match", "opc_client_request_id" @@ -921,11 +1056,19 @@ def head_bucket(self, namespace_name, bucket_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def head_object(self, namespace_name, bucket_name, object_name, **kwargs): """ @@ -963,6 +1106,7 @@ def head_object(self, namespace_name, bucket_name, object_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "if_none_match", "opc_client_request_id" @@ -993,11 +1137,19 @@ def head_object(self, namespace_name, bucket_name, object_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) def list_buckets(self, namespace_name, compartment_id, **kwargs): """ @@ -1016,7 +1168,7 @@ def list_buckets(self, namespace_name, compartment_id, **kwargs): The top-level namespace used for the request. :param str compartment_id: (required) - The ID of the compartment in which to create the bucket. + The ID of the compartment in which to list buckets. :param int limit: (optional) The maximum number of items to return. @@ -1035,6 +1187,7 @@ def list_buckets(self, namespace_name, compartment_id, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "opc_client_request_id" @@ -1068,13 +1221,23 @@ def list_buckets(self, namespace_name, compartment_id, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[BucketSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[BucketSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[BucketSummary]") def list_multipart_upload_parts(self, namespace_name, bucket_name, object_name, upload_id, **kwargs): """ @@ -1113,6 +1276,7 @@ def list_multipart_upload_parts(self, namespace_name, bucket_name, object_name, # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "opc_client_request_id" @@ -1148,13 +1312,23 @@ def list_multipart_upload_parts(self, namespace_name, bucket_name, object_name, } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[MultipartUploadPartSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[MultipartUploadPartSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[MultipartUploadPartSummary]") def list_multipart_uploads(self, namespace_name, bucket_name, **kwargs): """ @@ -1186,6 +1360,7 @@ def list_multipart_uploads(self, namespace_name, bucket_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "limit", "page", "opc_client_request_id" @@ -1219,13 +1394,23 @@ def list_multipart_uploads(self, namespace_name, bucket_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[MultipartUpload]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[MultipartUpload]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[MultipartUpload]") def list_objects(self, namespace_name, bucket_name, **kwargs): """ @@ -1260,10 +1445,10 @@ def list_objects(self, namespace_name, bucket_name, **kwargs): :param str delimiter: (optional) When this parameter is set, only objects whose names do not contain the delimiter character - (after an optionally specified prefix) are returned. Scanned objects whose names contain the - delimiter have part of their name up to the last occurrence of the delimiter (after the optional - prefix) returned as a set of prefixes. Note that only '/' is a supported delimiter character at - this time. + (after an optionally specified prefix) are returned in the objects key of the response body. + Scanned objects whose names contain the delimiter have the part of their name up to the first + occurrence of the delimiter (including the optional prefix) returned as a set of prefixes. + Note that only '/' is a supported delimiter character at this time. :param str fields: (optional) Object summary in list of objects includes the 'name' field. This parameter can also include 'size' @@ -1284,6 +1469,7 @@ def list_objects(self, namespace_name, bucket_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "prefix", "start", "end", @@ -1325,13 +1511,23 @@ def list_objects(self, namespace_name, bucket_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="ListObjects") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="ListObjects") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="ListObjects") def list_preauthenticated_requests(self, namespace_name, bucket_name, **kwargs): """ @@ -1366,6 +1562,7 @@ def list_preauthenticated_requests(self, namespace_name, bucket_name, **kwargs): # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "object_name_prefix", "limit", "page", @@ -1401,13 +1598,23 @@ def list_preauthenticated_requests(self, namespace_name, bucket_name, **kwargs): } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - response_type="list[PreauthenticatedRequestSummary]") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PreauthenticatedRequestSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="list[PreauthenticatedRequestSummary]") def put_object(self, namespace_name, bucket_name, object_name, put_object_body, **kwargs): """ @@ -1469,6 +1676,7 @@ def put_object(self, namespace_name, bucket_name, object_name, put_object_body, # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "content_length", "if_match", "if_none_match", @@ -1522,13 +1730,23 @@ def put_object(self, namespace_name, bucket_name, object_name, put_object_body, if requests.utils.super_len(put_object_body) == 0: header_params['Content-Length'] = '0' - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=put_object_body, - enforce_content_headers=False) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=put_object_body, + enforce_content_headers=False) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=put_object_body, + enforce_content_headers=False) def rename_object(self, namespace_name, bucket_name, rename_object_details, **kwargs): """ @@ -1557,6 +1775,7 @@ def rename_object(self, namespace_name, bucket_name, rename_object_details, **kw # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1582,12 +1801,21 @@ def rename_object(self, namespace_name, bucket_name, rename_object_details, **kw } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=rename_object_details) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=rename_object_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=rename_object_details) def restore_objects(self, namespace_name, bucket_name, restore_objects_details, **kwargs): """ @@ -1616,6 +1844,7 @@ def restore_objects(self, namespace_name, bucket_name, restore_objects_details, # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1641,12 +1870,21 @@ def restore_objects(self, namespace_name, bucket_name, restore_objects_details, } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=restore_objects_details) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=restore_objects_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=restore_objects_details) def update_bucket(self, namespace_name, bucket_name, update_bucket_details, **kwargs): """ @@ -1679,6 +1917,7 @@ def update_bucket(self, namespace_name, bucket_name, update_bucket_details, **kw # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "if_match", "opc_client_request_id" ] @@ -1706,13 +1945,23 @@ def update_bucket(self, namespace_name, bucket_name, update_bucket_details, **kw } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_bucket_details, - response_type="Bucket") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_bucket_details, + response_type="Bucket") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_bucket_details, + response_type="Bucket") def update_namespace_metadata(self, namespace_name, update_namespace_metadata_details, **kwargs): """ @@ -1740,6 +1989,7 @@ def update_namespace_metadata(self, namespace_name, update_namespace_metadata_de # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1764,13 +2014,23 @@ def update_namespace_metadata(self, namespace_name, update_namespace_metadata_de } header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - header_params=header_params, - body=update_namespace_metadata_details, - response_type="NamespaceMetadata") + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_namespace_metadata_details, + response_type="NamespaceMetadata") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_namespace_metadata_details, + response_type="NamespaceMetadata") def upload_part(self, namespace_name, bucket_name, object_name, upload_id, upload_part_num, upload_part_body, **kwargs): """ @@ -1826,6 +2086,7 @@ def upload_part(self, namespace_name, bucket_name, object_name, upload_id, uploa # Don't accept unknown kwargs expected_kwargs = [ + "retry_strategy", "content_length", "opc_client_request_id", "if_match", @@ -1875,11 +2136,22 @@ def upload_part(self, namespace_name, bucket_name, object_name, upload_id, uploa if requests.utils.super_len(upload_part_body) == 0: header_params['Content-Length'] = '0' - return self.base_client.call_api( - resource_path=resource_path, - method=method, - path_params=path_params, - query_params=query_params, - header_params=header_params, - body=upload_part_body, - enforce_content_headers=False) + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=upload_part_body, + enforce_content_headers=False) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=upload_part_body, + enforce_content_headers=False) diff --git a/src/oci/pagination/__init__.py b/src/oci/pagination/__init__.py index 15934d0751..9b10411381 100644 --- a/src/oci/pagination/__init__.py +++ b/src/oci/pagination/__init__.py @@ -1,5 +1,5 @@ # coding: utf-8 -# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. from .pagination_utils import list_call_get_all_results, list_call_get_up_to_limit, list_call_get_all_results_generator, list_call_get_up_to_limit_generator diff --git a/src/oci/pagination/internal/__init__.py b/src/oci/pagination/internal/__init__.py deleted file mode 100644 index 6565a7bb57..0000000000 --- a/src/oci/pagination/internal/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. - -from . import retry - -__all__ = ["retry"] diff --git a/src/oci/pagination/internal/retry.py b/src/oci/pagination/internal/retry.py deleted file mode 100644 index f247276709..0000000000 --- a/src/oci/pagination/internal/retry.py +++ /dev/null @@ -1,199 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. - -from . import retry_checkers - -import random -import time - - -class RetryStrategyBuilder(object): - """ - A class which can build a retry strategy based on provided criteria. Criteria can be provided at construction time or - afterwards via using the add_* (to add/enable criteria) and no_* (to disable/remove criteria) methods. - - When calculating the delay between retries, we use exponential backoff with full jitter as the default strategy - vended by this builder. - """ - BACKOFF_FULL_JITTER = 'full_jitter' - - def __init__(self, **kwargs): - """ - Creates a new builder and initializes it based on any provided parameters. - - :param Boolean max_attempts_check (optional): - Whether to enable a check that we don't exceed a certain number of attempts. If not provided - this defaults to False (i.e. this check will not be done) - - :param Boolean service_error_check (optional): - Whether to enable a check that will retry on connection errors, timeouts and service errors - which match given combinations of HTTP statuses and textual error codes. If not provided - this defaults to False (i.e. this check will not be done) - - :param int max_atttemps (optional): - If we are checking that we don't exceed a certain number of attempts, what that number of - attempts should be. This only applies if we are performing a check on the maximum number of - attempts and will be ignored otherwise. If we are performing a check on the maximum number of - attempts and this value is not provided, we will default to a maximum of 5 attempts - - :param dict service_error_retry_config (optional): - If we are checking on service errors, we can configure what HTTP statuses (e.g. 429) to retry on and, optionally, - whether the textual code (e.g. TooManyRequests) matches a given value. - - This is a dictionary where the key is an integer representing the HTTP status, and the value is a list(str) where we - will test if the textual code in the service error is a member of the list. If an empty list is provided, then only - the numeric status is checked for retry purposes. - - If we are performing a check on service errors and this value is not provided, then by default we will retry on - HTTP 429's (throttles) without any textual code check. - - :param Boolean service_error_retry_on_any_5xx (optional): - If we are checking on service errors, whether to retry on any HTTP 5xx received from the service. If - we are performing a check on service errors and this value is not provided, it defaults to True (retry on any 5xx) - - :param int retry_base_sleep_time_millis (optional): - For exponential backoff with jitter, the base time to use in our retry calculation in milliseconds. If not - provided, this value defaults to 1000ms (i.e. 1 second) - - :param int retry_exponential_growth_factor (optional): - For exponential backoff with jitter, the exponent which we will raise to the power of the number of attempts. If - not provided, this value defaults to 2 - - :param int retry_max_wait_time_millis (optional): - For exponential backoff with jitter, the maximum amount of time to wait between retries. If not provided, this - value defaults to 8000ms (i.e. 8 seconds) - - :param str backoff_type (optional): - The type of backoff we want to do (e.g. full jitter). Currently the only supported value is 'full_jitter' (the convenience - constant BACKOFF_FULL_JITTER in this class can also be used) - """ - - self.max_attempts_check = kwargs.get('max_attempts_check', False) - self.service_error_check = kwargs.get('service_error_check', False) - - self.max_attempts = kwargs.get('max_attempts', None) - self.service_error_retry_config = kwargs.get('service_error_retry_config', {}) - self.service_error_retry_on_any_5xx = kwargs.get('service_error_retry_on_any_5xx', True) - - self.retry_base_sleep_time_millis = kwargs.get('retry_base_sleep_time_millis', 1000) - self.retry_exponential_growth_factor = kwargs.get('retry_exponential_growth_factor', 2) - self.retry_max_wait_time_millis = kwargs.get('retry_max_wait_time_millis', 8000) - - if 'backoff_type' in kwargs and kwargs['backoff_type'] != self.BACKOFF_FULL_JITTER: - raise ValueError('Currently full_jitter is the only supported backoff type') - - def add_max_attempts(self, max_attempts=None): - self.max_attempts_check = True - if max_attempts: - self.max_attempts = max_attempts - return self - - def no_max_attemps(self): - self.max_attempts_check = False - return self - - def add_service_error_check(self, **kwargs): - self.service_error_check = True - - if 'service_error_retry_config' in kwargs: - self.service_error_retry_config = kwargs['service_error_retry_config'] - elif 'service_error_status' in kwargs and 'service_error_codes' in kwargs: - self.service_error_retry_config[kwargs['service_error_status']] = kwargs['service_error_codes'] - - if 'service_error_retry_on_any_5xx' in kwargs: - self.service_error_retry_on_any_5xx = kwargs['service_error_retry_on_any_5xx'] - - return self - - def no_service_error_check(self): - self.service_error_check = False - return self - - def get_retry_strategy(self): - checkers = [] - - if self.max_attempts_check: - if self.max_attempts: - checkers.append(retry_checkers.LimitBasedRetryChecker(max_attempts=self.max_attempts)) - else: - checkers.append(retry_checkers.LimitBasedRetryChecker()) - - if self.service_error_check: - if self.service_error_retry_config: - checkers.append( - retry_checkers.TimeoutConnectionAndServiceErrorRetryChecker( - service_error_retry_config=self.service_error_retry_config, - retry_any_5xx=self.service_error_retry_on_any_5xx - ) - ) - else: - checkers.append(retry_checkers.TimeoutConnectionAndServiceErrorRetryChecker(retry_any_5xx=self.service_error_retry_on_any_5xx)) - - checker_container = retry_checkers.RetryCheckerContainer(checkers=checkers) - - return ExponentialBackoffWithFullJitterRetryStrategy( - base_sleep_time_millis=self.retry_base_sleep_time_millis, - exponent_growth_factor=self.retry_exponential_growth_factor, - max_wait_millis=self.retry_max_wait_time_millis, - checker_container=checker_container - ) - - -class ExponentialBackoffWithFullJitterRetryStrategy(object): - """ - A retry strategy which does exponential backoff and full jitter. Times used are in milliseconds and - the strategy can be described as: - - .. code-block:: none - - random(0, min(base_sleep_time_millis * exponent_growth_factor ** (attempt), max_wait_millis)) - - """ - - def __init__(self, base_sleep_time_millis, exponent_growth_factor, max_wait_millis, checker_container, **kwargs): - """ - Creates a new instance of an exponential backoff with full jitter retry strategy. - - :param int base_sleep_time_millis: - The base amount to sleep by, in milliseconds - - :param int exponent_growth_factor: - The exponent part of our backoff. We will raise take this value and raising it to the power - of attemps and then multiply this with base_sleep_time_millis - - :param int max_wait_millis: - The maximum time we will wait between calls - - :param retry_checkers.RetryCheckerContainer checker_container: - The checks to run to determine whether a failed call should be retried - """ - self.base_sleep_time_millis = base_sleep_time_millis - self.exponent_growth_factor = exponent_growth_factor - self.max_wait_millis = max_wait_millis - self.checkers = checker_container - - def make_retrying_call(self, func_ref, *func_args, **func_kwargs): - """ - Calls the function given by func_ref. Any positional (*func_args) and keyword (**func_kwargs) - arguments are passed as-is to func_ref. - - :param function func_ref: - The function that we should call with retries - - :return: the result of calling func_ref - """ - should_retry = True - attempt = 0 - while should_retry: - try: - return func_ref(*func_args, **func_kwargs) - except Exception as e: - attempt += 1 - if self.checkers.should_retry(exception=e, current_attempt=attempt): - self.do_sleep(attempt) - else: - raise - - def do_sleep(self, attempt): - sleep_time_millis = random.uniform(0, min(self.base_sleep_time_millis * (self.exponent_growth_factor ** attempt), self.max_wait_millis)) - time.sleep(sleep_time_millis / 1000.0) # time.sleep needs seconds, but can take fractional seconds diff --git a/src/oci/pagination/pagination_utils.py b/src/oci/pagination/pagination_utils.py index 29aa0084b7..3e63918a34 100644 --- a/src/oci/pagination/pagination_utils.py +++ b/src/oci/pagination/pagination_utils.py @@ -1,14 +1,9 @@ # coding: utf-8 -# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. -from .internal import retry +from .. import retry from ..response import Response -BASIC_RETRY_STRATEGY = retry.RetryStrategyBuilder() \ - .add_max_attempts() \ - .add_service_error_check() \ - .get_retry_strategy() - def list_call_get_up_to_limit(list_func_ref, record_limit, page_size, *list_func_args, **list_func_kwargs): """ @@ -88,7 +83,7 @@ def list_call_get_up_to_limit_generator(list_func_ref, record_limit, page_size, # If no limit was provided, make a single call if record_limit is None: list_func_kwargs['limit'] = page_size - single_call_result = BASIC_RETRY_STRATEGY.make_retrying_call(list_func_ref, *list_func_args, **list_func_kwargs) + single_call_result = retry.DEFAULT_RETRY_STRATEGY.make_retrying_call(list_func_ref, *list_func_args, **list_func_kwargs) if yield_mode == 'response': yield single_call_result @@ -105,7 +100,7 @@ def list_call_get_up_to_limit_generator(list_func_ref, record_limit, page_size, while keep_paginating and remaining_items_to_fetch > 0: list_func_kwargs['limit'] = min(page_size, remaining_items_to_fetch) - call_result = BASIC_RETRY_STRATEGY.make_retrying_call(list_func_ref, *list_func_args, **list_func_kwargs) + call_result = retry.DEFAULT_RETRY_STRATEGY.make_retrying_call(list_func_ref, *list_func_args, **list_func_kwargs) if yield_mode == 'response': yield call_result else: @@ -181,7 +176,7 @@ def list_call_get_all_results_generator(list_func_ref, yield_mode, *list_func_ar call_result = None while keep_paginating: - call_result = BASIC_RETRY_STRATEGY.make_retrying_call(list_func_ref, *list_func_args, **list_func_kwargs) + call_result = retry.DEFAULT_RETRY_STRATEGY.make_retrying_call(list_func_ref, *list_func_args, **list_func_kwargs) if yield_mode == 'response': yield call_result else: diff --git a/src/oci/regions.py b/src/oci/regions.py index a221bf4c70..ddfd74be3a 100644 --- a/src/oci/regions.py +++ b/src/oci/regions.py @@ -3,12 +3,18 @@ from . import service_endpoints +REGIONS_SHORT_NAMES = { + 'phx': 'us-phoenix-1', + 'iad': 'us-ashburn-1', + 'fra': 'eu-frankfurt-1' +} REGIONS = [ "us-phoenix-1", "us-ashburn-1", "eu-frankfurt-1" ] SERVICE_ENDPOINTS = service_endpoints.SERVICE_ENDPOINTS +SERVICE_ENDPOINTS['auth'] = 'https://auth.{domain}' DOMAIN_FORMAT = "{region}.oraclecloud.com" diff --git a/src/oci/retry/__init__.py b/src/oci/retry/__init__.py new file mode 100644 index 0000000000..05d44ad280 --- /dev/null +++ b/src/oci/retry/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from .retry import BACKOFF_FULL_JITTER_VALUE, BACKOFF_EQUAL_JITTER_VALUE, BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE +from .retry import RetryStrategyBuilder, NoneRetryStrategy, ExponentialBackoffRetryStrategyBase, ExponentialBackoffWithFullJitterRetryStrategy, ExponentialBackoffWithEqualJitterRetryStrategy, ExponentialBackoffWithFullJitterEqualForThrottlesRetryStrategy +from . import retry_checkers + +# A retry strategy which has all options enabled and which will use the default settings for those options +DEFAULT_RETRY_STRATEGY = RetryStrategyBuilder().add_max_attempts() \ + .add_total_elapsed_time() \ + .add_service_error_check() \ + .get_retry_strategy() + +__all__ = [ + "retry_checkers", "RetryStrategyBuilder", "NoneRetryStrategy", "ExponentialBackoffRetryStrategyBase", + "ExponentialBackoffWithFullJitterRetryStrategy", "ExponentialBackoffWithEqualJitterRetryStrategy", + "ExponentialBackoffWithFullJitterEqualForThrottlesRetryStrategy", + "DEFAULT_RETRY_STRATEGY", + "BACKOFF_FULL_JITTER_VALUE", "BACKOFF_EQUAL_JITTER_VALUE", "BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE" +] diff --git a/src/oci/retry/retry.py b/src/oci/retry/retry.py new file mode 100644 index 0000000000..b510d9e01b --- /dev/null +++ b/src/oci/retry/retry.py @@ -0,0 +1,383 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# Contains classes for defining and building retry strategies. + +from ..exceptions import ServiceError +from . import retry_checkers +from . import retry_sleep_utils + +import time + +BACKOFF_FULL_JITTER_VALUE = 'full_jitter' +BACKOFF_EQUAL_JITTER_VALUE = 'equal_jitter' +BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE = 'full_jitter_with_equal_on_throttle' + +VALID_BACKOFF_TYPES = [BACKOFF_FULL_JITTER_VALUE, BACKOFF_EQUAL_JITTER_VALUE, BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE] + + +class RetryStrategyBuilder(object): + """ + A class which can build a retry strategy based on provided criteria. Criteria can be provided at construction time or + afterwards via using the add_* (to add/enable criteria) and no_* (to disable/remove criteria) methods. + + Trying to build a strategy when there are no enabled checks will result in a :py:class:`oci.retry.NoneRetryStrategy` + being produced. + + This builder is intended as a convenience, but callers are also able to bypass this and construct retry strategies + directly. + """ + + def __init__(self, **kwargs): + """ + Creates a new builder and initializes it based on any provided parameters. + + :param Boolean max_attempts_check (optional): + Whether to enable a check that we don't exceed a certain number of attempts. If not provided + this defaults to False (i.e. this check will not be done) + + :param Boolean service_error_check (optional): + Whether to enable a check that will retry on connection errors, timeouts and service errors + which match given combinations of HTTP statuses and textual error codes. If not provided + this defaults to False (i.e. this check will not be done) + + :param Boolean total_elapsed_time_check (optional): + Whether to enable a check that we don't exceed a certain amount of time when retrying. This is intended + for scenarios such as "keep retrying for 5 minutes". If not provided this defaults to False + (i.e. this check will not be done) + + :param int max_atttemps (optional): + If we are checking that we don't exceed a certain number of attempts, what that number of + attempts should be. This only applies if we are performing a check on the maximum number of + attempts and will be ignored otherwise. If we are performing a check on the maximum number of + attempts and this value is not provided, we will default to a maximum of 5 attempts + + :param int total_elapsed_time_seconds (optional): + If we are checking that we don't exceed a certain amount of time when retrying, what that amount of + time should be (in seconds). This only applies if we are perfoming a check on the total elapsed time and will + be ignored otherwise. If we are performing a check on the total elapsed time and this value is not provided, we + will default to 300 seconds (5 minutes) + + :param dict service_error_retry_config (optional): + If we are checking on service errors, we can configure what HTTP statuses (e.g. 429) to retry on and, optionally, + whether the textual code (e.g. TooManyRequests) matches a given value. + + This is a dictionary where the key is an integer representing the HTTP status, and the value is a list(str) where we + will test if the textual code in the service error is a member of the list. If an empty list is provided, then only + the numeric status is checked for retry purposes. + + If we are performing a check on service errors and this value is not provided, then by default we will retry on + HTTP 429's (throttles) without any textual code check. + + :param Boolean service_error_retry_on_any_5xx (optional): + If we are checking on service errors, whether to retry on any HTTP 5xx received from the service. If + we are performing a check on service errors and this value is not provided, it defaults to True (retry on any 5xx) + + :param int retry_base_sleep_time_seconds (optional): + For exponential backoff with jitter, the base time to use in our retry calculation in seconds. If not + provided, this value defaults to 1 second + + :param int retry_exponential_growth_factor (optional): + For exponential backoff with jitter, the exponent which we will raise to the power of the number of attempts. If + not provided, this value defaults to 2 + + :param int retry_max_wait_between_calls_seconds (optional): + For exponential backoff with jitter, the maximum amount of time to wait between retries. If not provided, this + value defaults to 30 seconds + + :param str backoff_type (optional): + The type of backoff we want to do (e.g. full jitter). The convenience constants in this retry module: ``BACKOFF_FULL_JITTER_VALUE``, + ``BACKOFF_EQUAL_JITTER_VALUE``, and ``BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE`` can be used as values here. If no value is specified then + the value ``BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE`` will be used. This will use exponential backoff and full jitter on all retries + except for throttles, in which case it will use exponential backoff and equal jitter. + """ + + self.max_attempts_check = kwargs.get('max_attempts_check', False) + self.service_error_check = kwargs.get('service_error_check', False) + self.total_elapsed_time_check = kwargs.get('total_elapsed_time_check', False) + + self.max_attempts = kwargs.get('max_attempts', None) + self.total_elapsed_time_seconds = kwargs.get('total_elapsed_time_seconds', None) + self.service_error_retry_config = kwargs.get('service_error_retry_config', {}) + self.service_error_retry_on_any_5xx = kwargs.get('service_error_retry_on_any_5xx', True) + + self.retry_base_sleep_time_seconds = kwargs.get('retry_base_sleep_time_seconds', 1) + self.retry_exponential_growth_factor = kwargs.get('retry_exponential_growth_factor', 2) + self.retry_max_wait_between_calls_seconds = kwargs.get('retry_max_wait_between_calls_seconds', 30) + + self.backoff_type = BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE + if 'backoff_type' in kwargs: + if kwargs['backoff_type'] not in VALID_BACKOFF_TYPES: + raise ValueError('Unrecognized backoff type supplied. Recognized types are: {}'.format(VALID_BACKOFF_TYPES)) + else: + self.backoff_type = kwargs['backoff_type'] + + def add_max_attempts(self, max_attempts=None): + self.max_attempts_check = True + if max_attempts: + self.max_attempts = max_attempts + return self + + def no_max_attemps(self): + self.max_attempts_check = False + return self + + def add_total_elapsed_time(self, total_elapsed_time_seconds=None): + self.total_elapsed_time_check = True + if total_elapsed_time_seconds: + self.total_elapsed_time_seconds = total_elapsed_time_seconds + return self + + def no_total_elapsed_time(self): + self.total_elapsed_time_check = False + return self + + def add_service_error_check(self, **kwargs): + self.service_error_check = True + + if 'service_error_retry_config' in kwargs: + self.service_error_retry_config = kwargs['service_error_retry_config'] + elif 'service_error_status' in kwargs and 'service_error_codes' in kwargs: + self.service_error_retry_config[kwargs['service_error_status']] = kwargs['service_error_codes'] + + if 'service_error_retry_on_any_5xx' in kwargs: + self.service_error_retry_on_any_5xx = kwargs['service_error_retry_on_any_5xx'] + + return self + + def no_service_error_check(self): + self.service_error_check = False + return self + + def get_retry_strategy(self): + if not self.max_attempts_check and not self.service_error_check and not self.total_elapsed_time_check: + return NoneRetryStrategy() + + checkers = [] + + if self.max_attempts_check: + if self.max_attempts: + checkers.append(retry_checkers.LimitBasedRetryChecker(max_attempts=self.max_attempts)) + else: + checkers.append(retry_checkers.LimitBasedRetryChecker()) + + if self.service_error_check: + if self.service_error_retry_config: + checkers.append( + retry_checkers.TimeoutConnectionAndServiceErrorRetryChecker( + service_error_retry_config=self.service_error_retry_config, + retry_any_5xx=self.service_error_retry_on_any_5xx + ) + ) + else: + checkers.append(retry_checkers.TimeoutConnectionAndServiceErrorRetryChecker(retry_any_5xx=self.service_error_retry_on_any_5xx)) + + if self.total_elapsed_time_check: + if self.total_elapsed_time_seconds: + checkers.append(retry_checkers.TotalTimeExceededRetryChecker(time_limit_seconds=self.total_elapsed_time_seconds)) + else: + checkers.append(retry_checkers.TotalTimeExceededRetryChecker()) + + checker_container = retry_checkers.RetryCheckerContainer(checkers=checkers) + + if self.backoff_type == BACKOFF_FULL_JITTER_VALUE: + return ExponentialBackoffWithFullJitterRetryStrategy( + base_sleep_time_seconds=self.retry_base_sleep_time_seconds, + exponent_growth_factor=self.retry_exponential_growth_factor, + max_wait_between_calls_seconds=self.retry_max_wait_between_calls_seconds, + checker_container=checker_container + ) + elif self.backoff_type == BACKOFF_EQUAL_JITTER_VALUE: + return ExponentialBackoffWithEqualJitterRetryStrategy( + base_sleep_time_seconds=self.retry_base_sleep_time_seconds, + exponent_growth_factor=self.retry_exponential_growth_factor, + max_wait_between_calls_seconds=self.retry_max_wait_between_calls_seconds, + checker_container=checker_container + ) + elif self.backoff_type == BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE: + return ExponentialBackoffWithFullJitterEqualForThrottlesRetryStrategy( + base_sleep_time_seconds=self.retry_base_sleep_time_seconds, + exponent_growth_factor=self.retry_exponential_growth_factor, + max_wait_between_calls_seconds=self.retry_max_wait_between_calls_seconds, + checker_container=checker_container + ) + else: + raise RuntimeError('Unrecognized backup type: {}. Expected one of: {}'.format(self.backoff_type, VALID_BACKOFF_TYPES)) + + +class NoneRetryStrategy(object): + """ + A strategy that does not retry + """ + + def make_retrying_call(self, func_ref, *func_args, **func_kwargs): + func_ref(*func_args, **func_kwargs) + + +class ExponentialBackoffRetryStrategyBase(object): + """ + A base retry strategy from which other retry strategies inherit. Implementors can create a subclass of this to define + their own retry logic. This is primarily useful when an implementor wishes to customize the sleep strategy used - to + customize the checking logic on whether a retry should be done, implementors can define their own subclasses of + :py:class:`oci.retry.retry_checkers.BaseRetryChecker` and provide this in the checker container. + """ + + def __init__(self, base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, checker_container, **kwargs): + """ + Creates a new instance of an exponential backoff with full jitter retry strategy. + + :param int base_sleep_time_seconds: + The base amount to sleep by, in seconds + + :param int exponent_growth_factor: + The exponent part of our backoff. We will raise take this value and raising it to the power + of attemps and then multiply this with base_sleep_time_seconds + + :param int max_wait_between_calls_seconds: + The maximum time we will wait between calls, in seconds + + :param retry_checkers.RetryCheckerContainer checker_container: + The checks to run to determine whether a failed call should be retried + """ + self.base_sleep_time_seconds = base_sleep_time_seconds + self.exponent_growth_factor = exponent_growth_factor + self.max_wait_between_calls_seconds = max_wait_between_calls_seconds + self.checkers = checker_container + + def make_retrying_call(self, func_ref, *func_args, **func_kwargs): + """ + Calls the function given by func_ref. Any positional (*func_args) and keyword (**func_kwargs) + arguments are passed as-is to func_ref. + + :param function func_ref: + The function that we should call with retries + + :return: the result of calling func_ref + """ + should_retry = True + attempt = 0 + start_time = time.time() + while should_retry: + try: + return func_ref(*func_args, **func_kwargs) + except Exception as e: + attempt += 1 + if self.checkers.should_retry(exception=e, current_attempt=attempt, total_time_elapsed=(time.time() - start_time)): + self.do_sleep(attempt, e) + else: + raise + + def do_sleep(self, attempt, exception): + raise NotImplementedError('Subclasses should implement this') + + +class ExponentialBackoffWithFullJitterRetryStrategy(ExponentialBackoffRetryStrategyBase): + """ + A retry strategy which does exponential backoff and full jitter. Times used are in milliseconds and + the strategy can be described as: + + .. code-block:: none + + random(0, min(base_sleep_time_seconds * exponent_growth_factor ** (attempt), max_wait_seconds)) + + """ + + def __init__(self, base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, checker_container, **kwargs): + """ + Creates a new instance of an exponential backoff with full jitter retry strategy. + + :param int base_sleep_time_seconds: + The base amount to sleep by, in seconds + + :param int exponent_growth_factor: + The exponent part of our backoff. We will raise take this value and raising it to the power + of attemps and then multiply this with base_sleep_time_seconds + + :param int max_wait_between_calls_seconds: + The maximum time we will wait between calls, in seconds + + :param retry_checkers.RetryCheckerContainer checker_container: + The checks to run to determine whether a failed call should be retried + """ + super(ExponentialBackoffWithFullJitterRetryStrategy, self) \ + .__init__(base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, checker_container, **kwargs) + + def do_sleep(self, attempt, exception): + sleep_time_millis = retry_sleep_utils.get_exponential_backoff_with_full_jitter_sleep_time(self.base_sleep_time_seconds, self.exponent_growth_factor, self.max_wait_between_calls_seconds, attempt) + time.sleep(sleep_time_millis / 1000.0) # time.sleep needs seconds, but can take fractional seconds + + +class ExponentialBackoffWithEqualJitterRetryStrategy(ExponentialBackoffRetryStrategyBase): + """ + A retry strategy which does exponential backoff and equal jitter. Times used are in milliseconds and + the strategy can be described as: + + .. code-block:: none + + exponential_backoff_sleep = min(base_sleep_time_seconds * exponent_growth_factor ** (attempt), max_wait_seconds) + sleep_with_jitter = (exponential_backoff_sleep / 2) + random(0, exponential_backoff_sleep / 2) + + """ + + def __init__(self, base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, checker_container, **kwargs): + """ + Creates a new instance of an exponential backoff with equal jitter retry strategy. + + :param int base_sleep_time_seconds: + The base amount to sleep by, in seconds + + :param int exponent_growth_factor: + The exponent part of our backoff. We will raise take this value and raising it to the power + of attemps and then multiply this with base_sleep_time_seconds + + :param int max_wait_between_calls_seconds: + The maximum time we will wait between calls, in seconds + + :param retry_checkers.RetryCheckerContainer checker_container: + The checks to run to determine whether a failed call should be retried + """ + super(ExponentialBackoffWithEqualJitterRetryStrategy, self) \ + .__init__(base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, checker_container, **kwargs) + + def do_sleep(self, attempt, exception): + sleep_time_seconds = retry_sleep_utils.get_exponential_backoff_with_equal_jitter_sleep_time(self.base_sleep_time_seconds, self.exponent_growth_factor, self.max_wait_between_calls_seconds, attempt) + time.sleep(sleep_time_seconds) + + +class ExponentialBackoffWithFullJitterEqualForThrottlesRetryStrategy(ExponentialBackoffRetryStrategyBase): + """ + A retry strategy that does exponential backoff and full jitter for most retries, but uses exponential backoff with equal + jitter for throttles. This provides a reasonable distribution of retry times for most retryable error cases, but for throttles + guarantees some sleep time + """ + + def __init__(self, base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, checker_container, **kwargs): + """ + Creates a new instance of the retry strategy. + + :param int base_sleep_time_seconds: + The base amount to sleep by, in seconds + + :param int exponent_growth_factor: + The exponent part of our backoff. We will raise take this value and raising it to the power + of attemps and then multiply this with base_sleep_time_seconds + + :param int max_wait_between_calls_seconds: + The maximum time we will wait between calls, in seconds + + :param retry_checkers.RetryCheckerContainer checker_container: + The checks to run to determine whether a failed call should be retried + """ + super(ExponentialBackoffWithFullJitterEqualForThrottlesRetryStrategy, self) \ + .__init__(base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, checker_container, **kwargs) + + def do_sleep(self, attempt, exception): + if isinstance(exception, ServiceError): + if exception.status == 429: + sleep_time_seconds = retry_sleep_utils.get_exponential_backoff_with_equal_jitter_sleep_time(self.base_sleep_time_seconds, self.exponent_growth_factor, self.max_wait_between_calls_seconds, attempt) + else: + sleep_time_seconds = retry_sleep_utils.get_exponential_backoff_with_full_jitter_sleep_time(self.base_sleep_time_seconds, self.exponent_growth_factor, self.max_wait_between_calls_seconds, attempt) + else: + sleep_time_seconds = retry_sleep_utils.get_exponential_backoff_with_full_jitter_sleep_time(self.base_sleep_time_seconds, self.exponent_growth_factor, self.max_wait_between_calls_seconds, attempt) + + time.sleep(sleep_time_seconds) diff --git a/src/oci/pagination/internal/retry_checkers.py b/src/oci/retry/retry_checkers.py similarity index 85% rename from src/oci/pagination/internal/retry_checkers.py rename to src/oci/retry/retry_checkers.py index 32b79559d5..9613bdbb10 100644 --- a/src/oci/pagination/internal/retry_checkers.py +++ b/src/oci/retry/retry_checkers.py @@ -1,10 +1,10 @@ # coding: utf-8 -# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. -# +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + # Contains helper classes that can say whether a retry should occur based on various criteria, such as a maximum number of retries being # hit or the exception received from a service call (or the response from the service call if it didn't exception out). -from ...exceptions import ServiceError +from ..exceptions import ServiceError from requests.exceptions import Timeout from requests.exceptions import ConnectionError @@ -51,7 +51,7 @@ def should_retry(self, exception=None, response=None, **kwargs): class BaseRetryChecker(object): """ The base class from which all retry checkers should derive. This has no implementation but just defines the contract - for a checker. + for a checker. Implementors can extend this class to define their own checking logic. """ def __init__(self, **kwargs): @@ -73,10 +73,27 @@ def should_retry(self, exception=None, response=None, **kwargs): raise NotImplementedError('Subclasses should implement this') +class TotalTimeExceededRetryChecker(BaseRetryChecker): + """ + A retry checker which can retry as long as some upper time limit (in seconds) has not been breached. This is intended + for scenarios such as "keep retrying for 5 minutes". It is the responsiblity of the caller to track the total time + elapsed - objects of this class will not track this. + + If not specified, the default time limit is 300 seconds (5 minutes). + """ + + def __init__(self, time_limit_seconds=300, **kwargs): + super(TotalTimeExceededRetryChecker, self).__init__(**kwargs) + self.time_limit_seconds = time_limit_seconds + + def should_retry(self, exception=None, response=None, **kwargs): + return self.time_limit_seconds > kwargs.get('total_time_elapsed', 0) + + class LimitBasedRetryChecker(BaseRetryChecker): """ A retry checker which can retry as long as some threshold (# of attempts/tries) has not been breached. - It is the repsonsibility of the caller to track how many attempts/tries it has done - objects of this + It is the responsiblity of the caller to track how many attempts/tries it has done - objects of this class will not track this. If not specified, the default number of tries allowed is 5. Tries are also assumed to be one-based (i.e. the diff --git a/src/oci/retry/retry_sleep_utils.py b/src/oci/retry/retry_sleep_utils.py new file mode 100644 index 0000000000..c713dcd141 --- /dev/null +++ b/src/oci/retry/retry_sleep_utils.py @@ -0,0 +1,13 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +import random + + +def get_exponential_backoff_with_full_jitter_sleep_time(base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, attempt): + return random.uniform(0, min(base_sleep_time_seconds * (exponent_growth_factor ** attempt), max_wait_between_calls_seconds)) + + +def get_exponential_backoff_with_equal_jitter_sleep_time(base_sleep_time_seconds, exponent_growth_factor, max_wait_between_calls_seconds, attempt): + exponential_backoff_sleep = min(base_sleep_time_seconds * (exponent_growth_factor ** attempt), max_wait_between_calls_seconds) + return (exponential_backoff_sleep / 2.0) + random.uniform(0, exponential_backoff_sleep / 2.0) diff --git a/src/oci/signer.py b/src/oci/signer.py index 0166cda856..b6a9afca24 100644 --- a/src/oci/signer.py +++ b/src/oci/signer.py @@ -1,6 +1,8 @@ # coding: utf-8 # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +from __future__ import absolute_import + import base64 import email.utils import hashlib @@ -111,6 +113,8 @@ def inject_missing_headers(request, sign_body, enforce_content_headers): # HeaderSigner doesn't support private keys with passwords. # Patched since the constructor parses the key in __init__ class _PatchedHeaderSigner(httpsig_cffi.sign.HeaderSigner): + HEADER_SIGNER_TEMPLATE = 'Signature algorithm="rsa-sha256",headers="{}",keyId="{}",signature="%s",version="{}"' + """Internal. If you need to construct a Signer, use :class:`~.Signer` instead.""" def __init__(self, key_id, private_key, headers): # Dropped general support for the specific signing/hash the SDK uses. @@ -124,54 +128,42 @@ def __init__(self, key_id, private_key, headers): self._rsa_public = self._rsa_private.public_key() self.headers = headers - # Base template doesn't include version - template = 'Signature algorithm="rsa-sha256",headers="{}",keyId="{}",signature="%s",version="{}"' - self.signature_template = template.format(" ".join(headers), key_id, SIGNATURE_VERSION) - - -class Signer(requests.auth.AuthBase): - """A requests auth instance that can be reused across requests. - - You can manually sign calls by creating an instance of the signer, and - providing it as the ``auth`` argument to Requests functions: - - .. code-block:: python - - import requests - from oci import Signer - - auth = Signer(...) - resp = requests.get("https://...", auth=auth) - - - """ - - def __init__(self, tenancy, user, fingerprint, private_key_file_location, pass_phrase=None, private_key_content=None): - self.api_key = tenancy + "/" + user + "/" + fingerprint - - if private_key_content: - self.private_key = load_private_key(private_key_content, pass_phrase) - else: - self.private_key = load_private_key_from_file(private_key_file_location, pass_phrase) - - generic_headers = ["date", "(request-target)", "host"] - body_headers = ["content-length", "content-type", "x-content-sha256"] + self.signature_template = self.HEADER_SIGNER_TEMPLATE.format(" ".join(headers), key_id, SIGNATURE_VERSION) + def reset_signer(self, key_id, private_key): + self._hash = None + self._rsa_private = private_key + self._rsa_public = self._rsa_private.public_key() + self.signature_template = self.HEADER_SIGNER_TEMPLATE.format(" ".join(self.headers), key_id, SIGNATURE_VERSION) + + +# An abstract class whose subclasses can sign requests. This contains the core logic for creating a signer and signing +# requests, but does not source the required information: +# +# - api key +# - private key +# - headers +# +# As concrete implementations are expected to provide these and have their ways of sourcing/constructing them. +class AbstractBaseSigner(requests.auth.AuthBase): + def create_signers(self, api_key, private_key, generic_headers, body_headers): self._basic_signer = _PatchedHeaderSigner( - key_id=self.api_key, - private_key=self.private_key, + key_id=api_key, + private_key=private_key, headers=generic_headers) self._body_signer = _PatchedHeaderSigner( - key_id=self.api_key, - private_key=self.private_key, + key_id=api_key, + private_key=private_key, headers=generic_headers + body_headers) - def __call__(self, request, enforce_content_headers=True): + def validate_request(self, request): verb = request.method.lower() if verb not in ["get", "head", "delete", "put", "post", "patch"]: raise ValueError("Don't know how to sign request verb {}".format(verb)) + def do_request_sign(self, request, enforce_content_headers=True): + verb = request.method.lower() sign_body = verb in ["put", "post", "patch"] if sign_body and enforce_content_headers: signer = self._body_signer @@ -193,6 +185,48 @@ def __call__(self, request, enforce_content_headers=True): return request + def __call__(self, request, enforce_content_headers=True): + self.validate_request(request) + return self.do_request_sign(request, enforce_content_headers) + @property def without_content_headers(self): return functools.partial(self, enforce_content_headers=False) + + +class Signer(AbstractBaseSigner): + """ + A requests auth instance that can be reused across requests. This signer is intended to be used + when signing requests for a given user and it requires that user's ID, their private key + and cerificate fingerprint. + + The private key can be sourced from a file (private_key_file_location) or the PEM string can be + provided directly (private_key_content). + + The headers to be signed by this signer are not customizable. + + You can manually sign calls by creating an instance of the signer, and + providing it as the ``auth`` argument to Requests functions: + + .. code-block:: python + + import requests + from oci import Signer + + auth = Signer(...) + resp = requests.get("https://...", auth=auth) + + + """ + + def __init__(self, tenancy, user, fingerprint, private_key_file_location, pass_phrase=None, private_key_content=None): + self.api_key = tenancy + "/" + user + "/" + fingerprint + + if private_key_content: + self.private_key = load_private_key(private_key_content, pass_phrase) + else: + self.private_key = load_private_key_from_file(private_key_file_location, pass_phrase) + + generic_headers = ["date", "(request-target)", "host"] + body_headers = ["content-length", "content-type", "x-content-sha256"] + self.create_signers(self.api_key, self.private_key, generic_headers, body_headers) diff --git a/src/oci/version.py b/src/oci/version.py index 5f133d05d8..85074cac47 100644 --- a/src/oci/version.py +++ b/src/oci/version.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. -__version__ = "1.3.12" +__version__ = "1.3.13" diff --git a/tests/conftest.py b/tests/conftest.py index e02470d19c..5d16f17983 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,8 @@ from tests.util import get_resource_path from tests.util import simple_retries_decorator +from . import test_config_container + def pytest_addoption(parser): parser.addoption("--config-file", action="store", help="location of the config file", @@ -16,6 +18,11 @@ def pytest_addoption(parser): parser.addoption("--config-profile", action="store", help="profile to use from the config file", default=oci.config.DEFAULT_PROFILE) + parser.addoption("--vcr-record-mode", action="store", default='once', help="Record mode option for VCRpy library.") + + +def pytest_configure(config): + test_config_container.vcr_mode = config.getoption("--vcr-record-mode") @pytest.fixture diff --git a/tests/integ/test_launch_instance_tutorial.py b/tests/integ/test_launch_instance_tutorial.py index 5d81a55ef7..799c755a37 100644 --- a/tests/integ/test_launch_instance_tutorial.py +++ b/tests/integ/test_launch_instance_tutorial.py @@ -8,6 +8,7 @@ import pytest from . import util +from .. import test_config_container def test_tutorial(virtual_network, compute, block_storage, config): @@ -28,36 +29,37 @@ def test_tutorial(virtual_network, compute, block_storage, config): volume = None attachment = None - try: - vcn = create_cloud_network(virtual_network, compartment, test_id) - subnet = create_subnet(virtual_network, compartment, test_id, availability_domain, vcn) - gateway = create_internet_gateway(virtual_network, compartment, test_id, vcn) - update_route_table(virtual_network, test_id, vcn, gateway) - - # There's a bug where the instance will immediately terminate if we - # don't add some extra wait time before launching. (COM-79) - time.sleep(15) - - instance = launch_instance( - compute, compartment, test_id, availability_domain, subnet, public_key) - log_public_ip_address(compute, virtual_network, compartment, instance) - - volume = create_volume(block_storage, compartment, test_id, availability_domain) - attachment = attach_volume(compute, compartment, instance, volume) - except Exception as e: - print('Exception during creation phase: ' + str(e)) - raise - finally: - if volume: - if attachment: - detach_volume(compute, attachment) - delete_volume(block_storage, volume) - if instance: - terminate_instance(compute, instance) - if subnet: - delete_subnet(virtual_network, subnet) - if vcn: - delete_cloud_network(virtual_network, vcn) + with test_config_container.create_vcr().use_cassette('launch_instance_tutorial.yml'): + try: + vcn = create_cloud_network(virtual_network, compartment, test_id) + subnet = create_subnet(virtual_network, compartment, test_id, availability_domain, vcn) + gateway = create_internet_gateway(virtual_network, compartment, test_id, vcn) + update_route_table(virtual_network, test_id, vcn, gateway) + + # There's a bug where the instance will immediately terminate if we + # don't add some extra wait time before launching. (COM-79) + time.sleep(15) + + instance = launch_instance( + compute, compartment, test_id, availability_domain, subnet, public_key) + log_public_ip_address(compute, virtual_network, compartment, instance) + + volume = create_volume(block_storage, compartment, test_id, availability_domain) + attachment = attach_volume(compute, compartment, instance, volume) + except Exception as e: + print('Exception during creation phase: ' + str(e)) + raise + finally: + if volume: + if attachment: + detach_volume(compute, attachment) + delete_volume(block_storage, volume) + if instance: + terminate_instance(compute, instance) + if subnet: + delete_subnet(virtual_network, subnet) + if vcn: + delete_cloud_network(virtual_network, vcn) def create_cloud_network(virtual_network, compartment, test_id): @@ -73,12 +75,7 @@ def create_cloud_network(virtual_network, compartment, test_id): assert type(response.data) is oci.core.models.Vcn response = virtual_network.get_vcn(response.data.id) - vcn = oci.wait_until( - virtual_network, - response, - 'lifecycle_state', - 'AVAILABLE' - ).data + vcn = test_config_container.do_wait(virtual_network, response, 'lifecycle_state', 'AVAILABLE').data assert 'AVAILABLE' == vcn.lifecycle_state return vcn @@ -91,7 +88,7 @@ def delete_cloud_network(virtual_network, vcn): with pytest.raises(oci.exceptions.ServiceError) as excinfo: response = virtual_network.get_vcn(vcn.id) - oci.wait_until( + test_config_container.do_wait( virtual_network, response, 'lifecycle_state', @@ -116,7 +113,7 @@ def create_subnet(virtual_network, compartment, test_id, availability_domain, vc assert type(response.data) is oci.core.models.Subnet response = virtual_network.get_subnet(response.data.id) - subnet = oci.wait_until( + subnet = test_config_container.do_wait( virtual_network, response, 'lifecycle_state', @@ -132,7 +129,7 @@ def delete_subnet(virtual_network, subnet): with pytest.raises(oci.exceptions.ServiceError) as excinfo: response = virtual_network.get_subnet(subnet.id) - oci.wait_until( + test_config_container.do_wait( virtual_network, response, 'lifecycle_state', @@ -154,7 +151,7 @@ def create_internet_gateway(virtual_network, compartment, test_id, vcn): assert type(response.data) is oci.core.models.InternetGateway response = virtual_network.get_internet_gateway(response.data.id) - gateway = oci.wait_until( + gateway = test_config_container.do_wait( virtual_network, response, 'lifecycle_state', @@ -180,7 +177,7 @@ def update_route_table(virtual_network, test_id, vcn, gateway): assert type(response.data) is oci.core.models.RouteTable response = virtual_network.get_route_table(vcn.default_route_table_id) - oci.wait_until(virtual_network, response, 'lifecycle_state', 'AVAILABLE') + test_config_container.do_wait(virtual_network, response, 'lifecycle_state', 'AVAILABLE') def launch_instance(compute, compartment, test_id, availability_domain, subnet, public_key): @@ -201,7 +198,7 @@ def launch_instance(compute, compartment, test_id, availability_domain, subnet, assert 'PROVISIONING' == response.data.lifecycle_state response = compute.get_instance(response.data.id) - instance = oci.wait_until( + instance = test_config_container.do_wait( compute, response, 'lifecycle_state', @@ -219,7 +216,7 @@ def terminate_instance(compute, instance): assert response.status == 204 response = compute.get_instance(instance.id) - oci.wait_until(compute, response, 'lifecycle_state', 'TERMINATED') + test_config_container.do_wait(compute, response, 'lifecycle_state', 'TERMINATED') def create_volume(block_storage, compartment, test_id, availability_domain): @@ -229,13 +226,13 @@ def create_volume(block_storage, compartment, test_id, availability_domain): request.compartment_id = compartment request.availability_domain = availability_domain response = block_storage.create_volume( - request, opc_retry_token='testtoken' + test_id) + request, opc_retry_token='testtoken{}'.format(int(time.time()))) assert response.status == 200 assert type(response.data) is oci.core.models.Volume response = block_storage.get_volume(response.data.id) - volume = oci.wait_until( + volume = test_config_container.do_wait( block_storage, response, 'lifecycle_state', @@ -251,7 +248,7 @@ def delete_volume(block_storage, volume): assert response.status == 204 response = block_storage.get_volume(volume.id) - oci.wait_until( + test_config_container.do_wait( block_storage, response, 'lifecycle_state', @@ -271,7 +268,7 @@ def log_public_ip_address(compute, virtual_network, compartment, instance): # Just get the address for the first vnic attachment. response = virtual_network.get_vnic(vnic_attachment.vnic_id) - response = oci.wait_until( + response = test_config_container.do_wait( virtual_network, response, 'lifecycle_state', @@ -294,7 +291,7 @@ def attach_volume(compute, compartment, instance, volume): assert type(response.data) is oci.core.models.IScsiVolumeAttachment response = compute.get_volume_attachment(response.data.id) - attachment = oci.wait_until( + attachment = test_config_container.do_wait( compute, response, 'lifecycle_state', @@ -309,4 +306,4 @@ def detach_volume(compute, attachment): assert response.status == 204 response = compute.get_volume_attachment(attachment.id) - oci.wait_until(compute, response, 'lifecycle_state', 'DETACHED') + test_config_container.do_wait(compute, response, 'lifecycle_state', 'DETACHED') diff --git a/tests/integ/util.py b/tests/integ/util.py index bd34ca0236..87d6c85619 100644 --- a/tests/integ/util.py +++ b/tests/integ/util.py @@ -9,6 +9,7 @@ import oci import os from oci.object_storage.transfer.constants import MEBIBYTE +from .. import test_config_container TEST_DATA_VERSION = '1' @@ -73,7 +74,10 @@ def windows_vm_image(): def random_name(prefix, insert_underscore=True): - return prefix + ('_' if insert_underscore else '') + str(random.randint(0, 1000000)) + if test_config_container.using_vcr_with_mock_responses(): + return prefix + ('_' if insert_underscore else '') + 'vcr' + else: + return prefix + ('_' if insert_underscore else '') + str(random.randint(0, 1000000)) def validate_response(result, extra_validation=None, includes_debug_data=False, expect_etag=False): @@ -135,7 +139,8 @@ def wait_until(get_command, state, max_wait_seconds=30, max_interval_seconds=15, elif result.data.lifecycle_state == state: break - time.sleep(sleep_interval_seconds) + if not test_config_container.using_vcr_with_mock_responses(): + time.sleep(sleep_interval_seconds) # Double the sleep each time up to the maximum. sleep_interval_seconds = min(sleep_interval_seconds * 2, max_interval_seconds) diff --git a/tests/test_config_container.py b/tests/test_config_container.py new file mode 100644 index 0000000000..2f9d815067 --- /dev/null +++ b/tests/test_config_container.py @@ -0,0 +1,37 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# A module which holds test configuration information. This is intended to be a shared space where tests +# can figure out what kind of recording (via VCR) is being done and also so that they can take actions (e.g. waiting) +# in a VCR compatible/friendly way + +import oci +import vcr + +vcr_mode = None + + +def using_vcr_with_mock_responses(): + return vcr_mode != 'all' + + +def create_vcr(**kwargs): + vcr_to_use = vcr.VCR( + serializer='yaml', + cassette_library_dir='tests/fixtures/cassettes', + record_mode=vcr_mode + ) + + if 'match_on' in kwargs: + vcr_to_use.match_on = kwargs['match_on'] + + return vcr_to_use + + +# A wrapper around the standard waiter functionality so that if we're mocking responses we don't sleep as we normally +# would (since responses are just going to get returned immediately by VCR anyway) +def do_wait(client, *args, **kwargs): + if vcr_mode == 'none': + kwargs['max_interval_seconds'] = 0 + + return oci.wait_until(client, *args, **kwargs) diff --git a/tests/util.py b/tests/util.py index 0743c5efbc..396120e78f 100644 --- a/tests/util.py +++ b/tests/util.py @@ -10,14 +10,21 @@ from contextlib import contextmanager from requests.exceptions import Timeout from requests.exceptions import ConnectionError +from . import test_config_container def random_number_string(): - return str(random.randint(0, 10000)) + if test_config_container.using_vcr_with_mock_responses(): + return '10000' + else: + return str(random.randint(0, 10000)) def unique_name(base_name): - return base_name + '_' + random_number_string() + if test_config_container.using_vcr_with_mock_responses(): + return '{}_vcr'.format(base_name) + else: + return base_name + '_' + random_number_string() def get_resource_directory():