diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 21b4c1b8fb..e0f3d7e0ac 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,15 @@ Change Log All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_. +==================== +2.10.1 - 2020-01-21 +==================== + +Added +----- +* Support for getting DRG redundancy status in the Networking service +* Support for cloning autonomous databases from backups in the Database service + ==================== 2.10.0 - 2020-01-14 ==================== diff --git a/docs/api/core.rst b/docs/api/core.rst index 7c9190cc77..15658724b3 100644 --- a/docs/api/core.rst +++ b/docs/api/core.rst @@ -157,6 +157,7 @@ Core Services oci.core.models.DhcpSearchDomainOption oci.core.models.Drg oci.core.models.DrgAttachment + oci.core.models.DrgRedundancyStatus oci.core.models.EgressSecurityRule oci.core.models.EmulatedVolumeAttachment oci.core.models.ExportImageDetails diff --git a/docs/api/core/models/oci.core.models.DrgRedundancyStatus.rst b/docs/api/core/models/oci.core.models.DrgRedundancyStatus.rst new file mode 100644 index 0000000000..f751a9146e --- /dev/null +++ b/docs/api/core/models/oci.core.models.DrgRedundancyStatus.rst @@ -0,0 +1,11 @@ +DrgRedundancyStatus +=================== + +.. currentmodule:: oci.core.models + +.. autoclass:: DrgRedundancyStatus + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/database.rst b/docs/api/database.rst index 6ce2ce6dd5..be9525fd2e 100644 --- a/docs/api/database.rst +++ b/docs/api/database.rst @@ -58,6 +58,8 @@ Database oci.database.models.CreateAutonomousDatabaseBase oci.database.models.CreateAutonomousDatabaseCloneDetails oci.database.models.CreateAutonomousDatabaseDetails + oci.database.models.CreateAutonomousDatabaseFromBackupDetails + oci.database.models.CreateAutonomousDatabaseFromBackupTimestampDetails oci.database.models.CreateBackupDestinationDetails oci.database.models.CreateBackupDetails oci.database.models.CreateDataGuardAssociationDetails diff --git a/docs/api/database/models/oci.database.models.CreateAutonomousDatabaseFromBackupDetails.rst b/docs/api/database/models/oci.database.models.CreateAutonomousDatabaseFromBackupDetails.rst new file mode 100644 index 0000000000..41ba4a4a1c --- /dev/null +++ b/docs/api/database/models/oci.database.models.CreateAutonomousDatabaseFromBackupDetails.rst @@ -0,0 +1,11 @@ +CreateAutonomousDatabaseFromBackupDetails +========================================= + +.. currentmodule:: oci.database.models + +.. autoclass:: CreateAutonomousDatabaseFromBackupDetails + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/database/models/oci.database.models.CreateAutonomousDatabaseFromBackupTimestampDetails.rst b/docs/api/database/models/oci.database.models.CreateAutonomousDatabaseFromBackupTimestampDetails.rst new file mode 100644 index 0000000000..4ebe5fb958 --- /dev/null +++ b/docs/api/database/models/oci.database.models.CreateAutonomousDatabaseFromBackupTimestampDetails.rst @@ -0,0 +1,11 @@ +CreateAutonomousDatabaseFromBackupTimestampDetails +================================================== + +.. currentmodule:: oci.database.models + +.. autoclass:: CreateAutonomousDatabaseFromBackupTimestampDetails + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 18af274457..8a8fa5de76 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,6 +6,8 @@ window.location.href = 'https://oracle-bare-metal-cloud-services-python-sdk.readthedocs.io/en/latest/deprecation-notice.html'; } +.. warning:: + Potential data corruption with Python SDK on binary upload in versions 2.8.0 and below, for more information please see :ref:`Known Issues` section. Oracle Cloud Infrastructure Python SDK - |OciSdkVersion| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -38,6 +40,7 @@ To get started, head over to the :ref:`installation instructions ` or s The most recent list of supported services is located on the `Python SDK `_ page on the Oracle Cloud Infrastructure Documentation site. + **Note**: The ``oraclebmc`` package is deprecated and will no longer be maintained starting March 2018. Please check the :ref:`Backward Compatibility ` section if you are using ``oraclebmc``. .. toctree:: diff --git a/docs/known-issues.rst b/docs/known-issues.rst index ba8ec8389e..2987d4fee3 100644 --- a/docs/known-issues.rst +++ b/docs/known-issues.rst @@ -28,11 +28,11 @@ If you need to retain the connection timeout while clearing the read timeout, yo client.base_client.timeout = (90.0, None) -Potential data corruption with Python SDK on binary upload -========================================================== +Potential data corruption with Python SDK on binary upload (versions 2.8.0 and below) +==================================================================================== **Details:** When using the Python SDK to perform binary upload operations you may encounter an issue with data corruption if retries are enabled or if you are using UploadManager.upload_file. -**Workaround:** We are aware of the issue and working on a resolution. For more information about this issue and workarounds, see `Potential data corruption issue for PythonSDK retry on binary data upload `_. +**Impacted Versions:** v2.8.0 and below -**Direct link to this issue:** `Potential data corruption with Python SDK on binary upload `_. \ No newline at end of file +**Direct link to this issue:** `Potential data corruption with Python SDK on binary upload `_ \ No newline at end of file diff --git a/docs/upload-manager.rst b/docs/upload-manager.rst index 8f76a697e8..33e9ed9507 100644 --- a/docs/upload-manager.rst +++ b/docs/upload-manager.rst @@ -16,12 +16,5 @@ The Object Storage service supports multipart uploads to make large object uploa The `UploadObject `_ example shows how :py:class:`~oci.object_storage.UploadManager` can be used to upload files to object storage. - -Potential data corruption with Python SDK on binary upload -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -**Details:** When using the Python SDK to perform binary upload operations you may encounter an issue with data corruption if retries are enabled or if you are using UploadManager.upload_file. - -**Workaround:** We are aware of the issue and working on a resolution. For more information about this issue and workarounds, see `Potential data corruption issue for PythonSDK retry on binary data upload `_. - -**Direct link to this issue:** `Potential data corruption with Python SDK on binary upload `_. \ No newline at end of file +.. warning:: + Potential data corruption with Python SDK on binary upload in versions 2.8.0 and below, for more information please see :ref:`Known Issues` section. \ No newline at end of file diff --git a/src/oci/core/models/__init__.py b/src/oci/core/models/__init__.py index 471fb4c859..d21db1bc66 100644 --- a/src/oci/core/models/__init__.py +++ b/src/oci/core/models/__init__.py @@ -136,6 +136,7 @@ from .dhcp_search_domain_option import DhcpSearchDomainOption from .drg import Drg from .drg_attachment import DrgAttachment +from .drg_redundancy_status import DrgRedundancyStatus from .egress_security_rule import EgressSecurityRule from .emulated_volume_attachment import EmulatedVolumeAttachment from .export_image_details import ExportImageDetails @@ -425,6 +426,7 @@ "DhcpSearchDomainOption": DhcpSearchDomainOption, "Drg": Drg, "DrgAttachment": DrgAttachment, + "DrgRedundancyStatus": DrgRedundancyStatus, "EgressSecurityRule": EgressSecurityRule, "EmulatedVolumeAttachment": EmulatedVolumeAttachment, "ExportImageDetails": ExportImageDetails, diff --git a/src/oci/core/models/drg_redundancy_status.py b/src/oci/core/models/drg_redundancy_status.py new file mode 100644 index 0000000000..ea8cc7a668 --- /dev/null +++ b/src/oci/core/models/drg_redundancy_status.py @@ -0,0 +1,140 @@ +# coding: utf-8 +# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + + +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class DrgRedundancyStatus(object): + """ + Redundancy status of the DRG object identified by ID + """ + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "NOT_AVAILABLE" + STATUS_NOT_AVAILABLE = "NOT_AVAILABLE" + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "REDUNDANT" + STATUS_REDUNDANT = "REDUNDANT" + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "NOT_REDUNDANT_SINGLE_IPSEC" + STATUS_NOT_REDUNDANT_SINGLE_IPSEC = "NOT_REDUNDANT_SINGLE_IPSEC" + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "NOT_REDUNDANT_SINGLE_VIRTUALCIRCUIT" + STATUS_NOT_REDUNDANT_SINGLE_VIRTUALCIRCUIT = "NOT_REDUNDANT_SINGLE_VIRTUALCIRCUIT" + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "NOT_REDUNDANT_MULTIPLE_IPSECS" + STATUS_NOT_REDUNDANT_MULTIPLE_IPSECS = "NOT_REDUNDANT_MULTIPLE_IPSECS" + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "NOT_REDUNDANT_MULTIPLE_VIRTUALCIRCUITS" + STATUS_NOT_REDUNDANT_MULTIPLE_VIRTUALCIRCUITS = "NOT_REDUNDANT_MULTIPLE_VIRTUALCIRCUITS" + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "NOT_REDUNDANT_MIX_CONNECTIONS" + STATUS_NOT_REDUNDANT_MIX_CONNECTIONS = "NOT_REDUNDANT_MIX_CONNECTIONS" + + #: A constant which can be used with the status property of a DrgRedundancyStatus. + #: This constant has a value of "NOT_REDUNDANT_NO_CONNECTION" + STATUS_NOT_REDUNDANT_NO_CONNECTION = "NOT_REDUNDANT_NO_CONNECTION" + + def __init__(self, **kwargs): + """ + Initializes a new DrgRedundancyStatus object with 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 DrgRedundancyStatus. + :type id: str + + :param status: + The value to assign to the status property of this DrgRedundancyStatus. + Allowed values for this property are: "NOT_AVAILABLE", "REDUNDANT", "NOT_REDUNDANT_SINGLE_IPSEC", "NOT_REDUNDANT_SINGLE_VIRTUALCIRCUIT", "NOT_REDUNDANT_MULTIPLE_IPSECS", "NOT_REDUNDANT_MULTIPLE_VIRTUALCIRCUITS", "NOT_REDUNDANT_MIX_CONNECTIONS", "NOT_REDUNDANT_NO_CONNECTION", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type status: str + + """ + self.swagger_types = { + 'id': 'str', + 'status': 'str' + } + + self.attribute_map = { + 'id': 'id', + 'status': 'status' + } + + self._id = None + self._status = None + + @property + def id(self): + """ + Gets the id of this DrgRedundancyStatus. + The DRG's unique identifier. + + + :return: The id of this DrgRedundancyStatus. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this DrgRedundancyStatus. + The DRG's unique identifier. + + + :param id: The id of this DrgRedundancyStatus. + :type: str + """ + self._id = id + + @property + def status(self): + """ + Gets the status of this DrgRedundancyStatus. + The redudancy status of the DRG specified. + + Allowed values for this property are: "NOT_AVAILABLE", "REDUNDANT", "NOT_REDUNDANT_SINGLE_IPSEC", "NOT_REDUNDANT_SINGLE_VIRTUALCIRCUIT", "NOT_REDUNDANT_MULTIPLE_IPSECS", "NOT_REDUNDANT_MULTIPLE_VIRTUALCIRCUITS", "NOT_REDUNDANT_MIX_CONNECTIONS", "NOT_REDUNDANT_NO_CONNECTION", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The status of this DrgRedundancyStatus. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """ + Sets the status of this DrgRedundancyStatus. + The redudancy status of the DRG specified. + + + :param status: The status of this DrgRedundancyStatus. + :type: str + """ + allowed_values = ["NOT_AVAILABLE", "REDUNDANT", "NOT_REDUNDANT_SINGLE_IPSEC", "NOT_REDUNDANT_SINGLE_VIRTUALCIRCUIT", "NOT_REDUNDANT_MULTIPLE_IPSECS", "NOT_REDUNDANT_MULTIPLE_VIRTUALCIRCUITS", "NOT_REDUNDANT_MIX_CONNECTIONS", "NOT_REDUNDANT_NO_CONNECTION"] + if not value_allowed_none_or_none_sentinel(status, allowed_values): + status = 'UNKNOWN_ENUM_VALUE' + self._status = 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/core/virtual_network_client.py b/src/oci/core/virtual_network_client.py index 103bf5bf79..14d7de642d 100644 --- a/src/oci/core/virtual_network_client.py +++ b/src/oci/core/virtual_network_client.py @@ -6232,6 +6232,80 @@ def get_drg_attachment(self, drg_attachment_id, **kwargs): header_params=header_params, response_type="DrgAttachment") + def get_drg_redundancy_status(self, drg_id, **kwargs): + """ + GetDrgRedundancyStatus + Get redundancy status of single DRG object on Oracle side. + + + :param str drg_id: (required) + The OCID of the DRG. + + :param str opc_request_id: (optional) + Unique identifier for the request. + If you need to contact Oracle about a particular request, please provide the request ID. + + :param obj retry_strategy: (optional) + A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level. + + This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` + is also available. The specifics of the default retry strategy are described `here `__. + + To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.DrgRedundancyStatus` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/drgs/{drgId}/redundancyStatus" + method = "GET" + + # 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] + if extra_kwargs: + raise ValueError( + "get_drg_redundancy_status got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "drgId": drg_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", + "opc-request-id": kwargs.get("opc_request_id", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing and v is not None} + + retry_strategy = self.retry_strategy + if kwargs.get('retry_strategy'): + retry_strategy = kwargs.get('retry_strategy') + + if retry_strategy: + return 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="DrgRedundancyStatus") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="DrgRedundancyStatus") + def get_fast_connect_provider_service(self, provider_service_id, **kwargs): """ GetFastConnectProviderService diff --git a/src/oci/database/models/__init__.py b/src/oci/database/models/__init__.py index d9fb238947..f641b8c7ab 100644 --- a/src/oci/database/models/__init__.py +++ b/src/oci/database/models/__init__.py @@ -43,6 +43,8 @@ from .create_autonomous_database_base import CreateAutonomousDatabaseBase from .create_autonomous_database_clone_details import CreateAutonomousDatabaseCloneDetails from .create_autonomous_database_details import CreateAutonomousDatabaseDetails +from .create_autonomous_database_from_backup_details import CreateAutonomousDatabaseFromBackupDetails +from .create_autonomous_database_from_backup_timestamp_details import CreateAutonomousDatabaseFromBackupTimestampDetails from .create_backup_destination_details import CreateBackupDestinationDetails from .create_backup_details import CreateBackupDetails from .create_data_guard_association_details import CreateDataGuardAssociationDetails @@ -176,6 +178,8 @@ "CreateAutonomousDatabaseBase": CreateAutonomousDatabaseBase, "CreateAutonomousDatabaseCloneDetails": CreateAutonomousDatabaseCloneDetails, "CreateAutonomousDatabaseDetails": CreateAutonomousDatabaseDetails, + "CreateAutonomousDatabaseFromBackupDetails": CreateAutonomousDatabaseFromBackupDetails, + "CreateAutonomousDatabaseFromBackupTimestampDetails": CreateAutonomousDatabaseFromBackupTimestampDetails, "CreateBackupDestinationDetails": CreateBackupDestinationDetails, "CreateBackupDetails": CreateBackupDetails, "CreateDataGuardAssociationDetails": CreateDataGuardAssociationDetails, diff --git a/src/oci/database/models/autonomous_database_backup.py b/src/oci/database/models/autonomous_database_backup.py index 1703dada88..1601da6862 100644 --- a/src/oci/database/models/autonomous_database_backup.py +++ b/src/oci/database/models/autonomous_database_backup.py @@ -93,6 +93,10 @@ def __init__(self, **kwargs): Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. :type lifecycle_state: str + :param is_restorable: + The value to assign to the is_restorable property of this AutonomousDatabaseBackup. + :type is_restorable: bool + """ self.swagger_types = { 'id': 'str', @@ -105,7 +109,8 @@ def __init__(self, **kwargs): 'time_ended': 'datetime', 'lifecycle_details': 'str', 'database_size_in_tbs': 'float', - 'lifecycle_state': 'str' + 'lifecycle_state': 'str', + 'is_restorable': 'bool' } self.attribute_map = { @@ -119,7 +124,8 @@ def __init__(self, **kwargs): 'time_ended': 'timeEnded', 'lifecycle_details': 'lifecycleDetails', 'database_size_in_tbs': 'databaseSizeInTBs', - 'lifecycle_state': 'lifecycleState' + 'lifecycle_state': 'lifecycleState', + 'is_restorable': 'isRestorable' } self._id = None @@ -133,6 +139,7 @@ def __init__(self, **kwargs): self._lifecycle_details = None self._database_size_in_tbs = None self._lifecycle_state = None + self._is_restorable = None @property def id(self): @@ -422,6 +429,30 @@ def lifecycle_state(self, lifecycle_state): lifecycle_state = 'UNKNOWN_ENUM_VALUE' self._lifecycle_state = lifecycle_state + @property + def is_restorable(self): + """ + Gets the is_restorable of this AutonomousDatabaseBackup. + Indicates whether the backup can be used to restore the associated Autonomous Database. + + + :return: The is_restorable of this AutonomousDatabaseBackup. + :rtype: bool + """ + return self._is_restorable + + @is_restorable.setter + def is_restorable(self, is_restorable): + """ + Sets the is_restorable of this AutonomousDatabaseBackup. + Indicates whether the backup can be used to restore the associated Autonomous Database. + + + :param is_restorable: The is_restorable of this AutonomousDatabaseBackup. + :type: bool + """ + self._is_restorable = is_restorable + def __repr__(self): return formatted_flat_dict(self) diff --git a/src/oci/database/models/autonomous_database_backup_summary.py b/src/oci/database/models/autonomous_database_backup_summary.py index f1b4284025..2580014a4f 100644 --- a/src/oci/database/models/autonomous_database_backup_summary.py +++ b/src/oci/database/models/autonomous_database_backup_summary.py @@ -98,6 +98,10 @@ def __init__(self, **kwargs): Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. :type lifecycle_state: str + :param is_restorable: + The value to assign to the is_restorable property of this AutonomousDatabaseBackupSummary. + :type is_restorable: bool + """ self.swagger_types = { 'id': 'str', @@ -110,7 +114,8 @@ def __init__(self, **kwargs): 'time_ended': 'datetime', 'lifecycle_details': 'str', 'database_size_in_tbs': 'float', - 'lifecycle_state': 'str' + 'lifecycle_state': 'str', + 'is_restorable': 'bool' } self.attribute_map = { @@ -124,7 +129,8 @@ def __init__(self, **kwargs): 'time_ended': 'timeEnded', 'lifecycle_details': 'lifecycleDetails', 'database_size_in_tbs': 'databaseSizeInTBs', - 'lifecycle_state': 'lifecycleState' + 'lifecycle_state': 'lifecycleState', + 'is_restorable': 'isRestorable' } self._id = None @@ -138,6 +144,7 @@ def __init__(self, **kwargs): self._lifecycle_details = None self._database_size_in_tbs = None self._lifecycle_state = None + self._is_restorable = None @property def id(self): @@ -427,6 +434,30 @@ def lifecycle_state(self, lifecycle_state): lifecycle_state = 'UNKNOWN_ENUM_VALUE' self._lifecycle_state = lifecycle_state + @property + def is_restorable(self): + """ + Gets the is_restorable of this AutonomousDatabaseBackupSummary. + Indicates whether the backup can be used to restore the associated Autonomous Database. + + + :return: The is_restorable of this AutonomousDatabaseBackupSummary. + :rtype: bool + """ + return self._is_restorable + + @is_restorable.setter + def is_restorable(self, is_restorable): + """ + Sets the is_restorable of this AutonomousDatabaseBackupSummary. + Indicates whether the backup can be used to restore the associated Autonomous Database. + + + :param is_restorable: The is_restorable of this AutonomousDatabaseBackupSummary. + :type: bool + """ + self._is_restorable = is_restorable + def __repr__(self): return formatted_flat_dict(self) diff --git a/src/oci/database/models/create_autonomous_database_base.py b/src/oci/database/models/create_autonomous_database_base.py index 915e8c04ca..a34acba01c 100644 --- a/src/oci/database/models/create_autonomous_database_base.py +++ b/src/oci/database/models/create_autonomous_database_base.py @@ -38,12 +38,22 @@ class CreateAutonomousDatabaseBase(object): #: This constant has a value of "DATABASE" SOURCE_DATABASE = "DATABASE" + #: A constant which can be used with the source property of a CreateAutonomousDatabaseBase. + #: This constant has a value of "BACKUP_FROM_ID" + SOURCE_BACKUP_FROM_ID = "BACKUP_FROM_ID" + + #: A constant which can be used with the source property of a CreateAutonomousDatabaseBase. + #: This constant has a value of "BACKUP_FROM_TIMESTAMP" + SOURCE_BACKUP_FROM_TIMESTAMP = "BACKUP_FROM_TIMESTAMP" + def __init__(self, **kwargs): """ Initializes a new CreateAutonomousDatabaseBase object with values from keyword arguments. This class has the following subclasses and if you are using this class as input to a service operations then you should favor using a subclass over the base class: * :class:`~oci.database.models.CreateAutonomousDatabaseCloneDetails` + * :class:`~oci.database.models.CreateAutonomousDatabaseFromBackupDetails` + * :class:`~oci.database.models.CreateAutonomousDatabaseFromBackupTimestampDetails` * :class:`~oci.database.models.CreateAutonomousDatabaseDetails` The following keyword arguments are supported (corresponding to the getters/setters of this class): @@ -116,7 +126,7 @@ def __init__(self, **kwargs): :param source: The value to assign to the source property of this CreateAutonomousDatabaseBase. - Allowed values for this property are: "NONE", "DATABASE" + Allowed values for this property are: "NONE", "DATABASE", "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP" :type source: str """ @@ -189,6 +199,12 @@ def get_subtype(object_dictionary): if type == 'DATABASE': return 'CreateAutonomousDatabaseCloneDetails' + if type == 'BACKUP_FROM_ID': + return 'CreateAutonomousDatabaseFromBackupDetails' + + if type == 'BACKUP_FROM_TIMESTAMP': + return 'CreateAutonomousDatabaseFromBackupTimestampDetails' + if type == 'NONE': return 'CreateAutonomousDatabaseDetails' else: @@ -654,7 +670,12 @@ def source(self): Gets the source of this CreateAutonomousDatabaseBase. The source of the database: Use `NONE` for creating a new Autonomous Database. Use `DATABASE` for creating a new Autonomous Database by cloning an existing Autonomous Database. - Allowed values for this property are: "NONE", "DATABASE" + For Autonomous Databases using the `serverless deployment`__, the following cloning options are available: Use `BACKUP_FROM_ID` for creating a new Autonomous Database from a specified backup. Use `BACKUP_FROM_TIMESTAMP` for creating a point-in-time Autonomous Database clone using backups. For more information, see `Cloning an Autonomous Database`__. + + __ https://docs.cloud.oracle.com/Content/Database/Concepts/adboverview.htm#AEI + __ https://docs.cloud.oracle.com/Content/Database/Tasks/adbcloning.htm + + Allowed values for this property are: "NONE", "DATABASE", "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP" :return: The source of this CreateAutonomousDatabaseBase. @@ -668,11 +689,16 @@ def source(self, source): Sets the source of this CreateAutonomousDatabaseBase. The source of the database: Use `NONE` for creating a new Autonomous Database. Use `DATABASE` for creating a new Autonomous Database by cloning an existing Autonomous Database. + For Autonomous Databases using the `serverless deployment`__, the following cloning options are available: Use `BACKUP_FROM_ID` for creating a new Autonomous Database from a specified backup. Use `BACKUP_FROM_TIMESTAMP` for creating a point-in-time Autonomous Database clone using backups. For more information, see `Cloning an Autonomous Database`__. + + __ https://docs.cloud.oracle.com/Content/Database/Concepts/adboverview.htm#AEI + __ https://docs.cloud.oracle.com/Content/Database/Tasks/adbcloning.htm + :param source: The source of this CreateAutonomousDatabaseBase. :type: str """ - allowed_values = ["NONE", "DATABASE"] + allowed_values = ["NONE", "DATABASE", "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP"] if not value_allowed_none_or_none_sentinel(source, allowed_values): raise ValueError( "Invalid value for `source`, must be None or one of {0}" diff --git a/src/oci/database/models/create_autonomous_database_clone_details.py b/src/oci/database/models/create_autonomous_database_clone_details.py index ec4f564dea..a894621053 100644 --- a/src/oci/database/models/create_autonomous_database_clone_details.py +++ b/src/oci/database/models/create_autonomous_database_clone_details.py @@ -94,7 +94,7 @@ def __init__(self, **kwargs): :param source: The value to assign to the source property of this CreateAutonomousDatabaseCloneDetails. - Allowed values for this property are: "NONE", "DATABASE" + Allowed values for this property are: "NONE", "DATABASE", "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP" :type source: str :param source_id: diff --git a/src/oci/database/models/create_autonomous_database_details.py b/src/oci/database/models/create_autonomous_database_details.py index a89a87487c..5cbf0c6064 100644 --- a/src/oci/database/models/create_autonomous_database_details.py +++ b/src/oci/database/models/create_autonomous_database_details.py @@ -86,7 +86,7 @@ def __init__(self, **kwargs): :param source: The value to assign to the source property of this CreateAutonomousDatabaseDetails. - Allowed values for this property are: "NONE", "DATABASE" + Allowed values for this property are: "NONE", "DATABASE", "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP" :type source: str """ diff --git a/src/oci/database/models/create_autonomous_database_from_backup_details.py b/src/oci/database/models/create_autonomous_database_from_backup_details.py new file mode 100644 index 0000000000..fabdc89583 --- /dev/null +++ b/src/oci/database/models/create_autonomous_database_from_backup_details.py @@ -0,0 +1,245 @@ +# coding: utf-8 +# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + +from .create_autonomous_database_base import CreateAutonomousDatabaseBase +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class CreateAutonomousDatabaseFromBackupDetails(CreateAutonomousDatabaseBase): + """ + Details to create an Oracle Autonomous Database by cloning from a backup of an existing Autonomous Database. + """ + + #: A constant which can be used with the clone_type property of a CreateAutonomousDatabaseFromBackupDetails. + #: This constant has a value of "FULL" + CLONE_TYPE_FULL = "FULL" + + #: A constant which can be used with the clone_type property of a CreateAutonomousDatabaseFromBackupDetails. + #: This constant has a value of "METADATA" + CLONE_TYPE_METADATA = "METADATA" + + def __init__(self, **kwargs): + """ + Initializes a new CreateAutonomousDatabaseFromBackupDetails object with values from keyword arguments. The default value of the :py:attr:`~oci.database.models.CreateAutonomousDatabaseFromBackupDetails.source` attribute + of this class is ``BACKUP_FROM_ID`` and it should not be changed. + 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 CreateAutonomousDatabaseFromBackupDetails. + :type compartment_id: str + + :param db_name: + The value to assign to the db_name property of this CreateAutonomousDatabaseFromBackupDetails. + :type db_name: str + + :param cpu_core_count: + The value to assign to the cpu_core_count property of this CreateAutonomousDatabaseFromBackupDetails. + :type cpu_core_count: int + + :param db_workload: + The value to assign to the db_workload property of this CreateAutonomousDatabaseFromBackupDetails. + Allowed values for this property are: "OLTP", "DW" + :type db_workload: str + + :param data_storage_size_in_tbs: + The value to assign to the data_storage_size_in_tbs property of this CreateAutonomousDatabaseFromBackupDetails. + :type data_storage_size_in_tbs: int + + :param is_free_tier: + The value to assign to the is_free_tier property of this CreateAutonomousDatabaseFromBackupDetails. + :type is_free_tier: bool + + :param admin_password: + The value to assign to the admin_password property of this CreateAutonomousDatabaseFromBackupDetails. + :type admin_password: str + + :param display_name: + The value to assign to the display_name property of this CreateAutonomousDatabaseFromBackupDetails. + :type display_name: str + + :param license_model: + The value to assign to the license_model property of this CreateAutonomousDatabaseFromBackupDetails. + Allowed values for this property are: "LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE" + :type license_model: str + + :param is_preview_version_with_service_terms_accepted: + The value to assign to the is_preview_version_with_service_terms_accepted property of this CreateAutonomousDatabaseFromBackupDetails. + :type is_preview_version_with_service_terms_accepted: bool + + :param is_auto_scaling_enabled: + The value to assign to the is_auto_scaling_enabled property of this CreateAutonomousDatabaseFromBackupDetails. + :type is_auto_scaling_enabled: bool + + :param is_dedicated: + The value to assign to the is_dedicated property of this CreateAutonomousDatabaseFromBackupDetails. + :type is_dedicated: bool + + :param autonomous_container_database_id: + The value to assign to the autonomous_container_database_id property of this CreateAutonomousDatabaseFromBackupDetails. + :type autonomous_container_database_id: str + + :param whitelisted_ips: + The value to assign to the whitelisted_ips property of this CreateAutonomousDatabaseFromBackupDetails. + :type whitelisted_ips: list[str] + + :param freeform_tags: + The value to assign to the freeform_tags property of this CreateAutonomousDatabaseFromBackupDetails. + :type freeform_tags: dict(str, str) + + :param defined_tags: + The value to assign to the defined_tags property of this CreateAutonomousDatabaseFromBackupDetails. + :type defined_tags: dict(str, dict(str, object)) + + :param source: + The value to assign to the source property of this CreateAutonomousDatabaseFromBackupDetails. + Allowed values for this property are: "NONE", "DATABASE", "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP" + :type source: str + + :param autonomous_database_backup_id: + The value to assign to the autonomous_database_backup_id property of this CreateAutonomousDatabaseFromBackupDetails. + :type autonomous_database_backup_id: str + + :param clone_type: + The value to assign to the clone_type property of this CreateAutonomousDatabaseFromBackupDetails. + Allowed values for this property are: "FULL", "METADATA" + :type clone_type: str + + """ + self.swagger_types = { + 'compartment_id': 'str', + 'db_name': 'str', + 'cpu_core_count': 'int', + 'db_workload': 'str', + 'data_storage_size_in_tbs': 'int', + 'is_free_tier': 'bool', + 'admin_password': 'str', + 'display_name': 'str', + 'license_model': 'str', + 'is_preview_version_with_service_terms_accepted': 'bool', + 'is_auto_scaling_enabled': 'bool', + 'is_dedicated': 'bool', + 'autonomous_container_database_id': 'str', + 'whitelisted_ips': 'list[str]', + 'freeform_tags': 'dict(str, str)', + 'defined_tags': 'dict(str, dict(str, object))', + 'source': 'str', + 'autonomous_database_backup_id': 'str', + 'clone_type': 'str' + } + + self.attribute_map = { + 'compartment_id': 'compartmentId', + 'db_name': 'dbName', + 'cpu_core_count': 'cpuCoreCount', + 'db_workload': 'dbWorkload', + 'data_storage_size_in_tbs': 'dataStorageSizeInTBs', + 'is_free_tier': 'isFreeTier', + 'admin_password': 'adminPassword', + 'display_name': 'displayName', + 'license_model': 'licenseModel', + 'is_preview_version_with_service_terms_accepted': 'isPreviewVersionWithServiceTermsAccepted', + 'is_auto_scaling_enabled': 'isAutoScalingEnabled', + 'is_dedicated': 'isDedicated', + 'autonomous_container_database_id': 'autonomousContainerDatabaseId', + 'whitelisted_ips': 'whitelistedIps', + 'freeform_tags': 'freeformTags', + 'defined_tags': 'definedTags', + 'source': 'source', + 'autonomous_database_backup_id': 'autonomousDatabaseBackupId', + 'clone_type': 'cloneType' + } + + self._compartment_id = None + self._db_name = None + self._cpu_core_count = None + self._db_workload = None + self._data_storage_size_in_tbs = None + self._is_free_tier = None + self._admin_password = None + self._display_name = None + self._license_model = None + self._is_preview_version_with_service_terms_accepted = None + self._is_auto_scaling_enabled = None + self._is_dedicated = None + self._autonomous_container_database_id = None + self._whitelisted_ips = None + self._freeform_tags = None + self._defined_tags = None + self._source = None + self._autonomous_database_backup_id = None + self._clone_type = None + self._source = 'BACKUP_FROM_ID' + + @property + def autonomous_database_backup_id(self): + """ + **[Required]** Gets the autonomous_database_backup_id of this CreateAutonomousDatabaseFromBackupDetails. + The `OCID`__ of the source Autonomous Database Backup that you will clone to create a new Autonomous Database. + + __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm + + + :return: The autonomous_database_backup_id of this CreateAutonomousDatabaseFromBackupDetails. + :rtype: str + """ + return self._autonomous_database_backup_id + + @autonomous_database_backup_id.setter + def autonomous_database_backup_id(self, autonomous_database_backup_id): + """ + Sets the autonomous_database_backup_id of this CreateAutonomousDatabaseFromBackupDetails. + The `OCID`__ of the source Autonomous Database Backup that you will clone to create a new Autonomous Database. + + __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm + + + :param autonomous_database_backup_id: The autonomous_database_backup_id of this CreateAutonomousDatabaseFromBackupDetails. + :type: str + """ + self._autonomous_database_backup_id = autonomous_database_backup_id + + @property + def clone_type(self): + """ + **[Required]** Gets the clone_type of this CreateAutonomousDatabaseFromBackupDetails. + The Autonomous Database clone type. + + Allowed values for this property are: "FULL", "METADATA" + + + :return: The clone_type of this CreateAutonomousDatabaseFromBackupDetails. + :rtype: str + """ + return self._clone_type + + @clone_type.setter + def clone_type(self, clone_type): + """ + Sets the clone_type of this CreateAutonomousDatabaseFromBackupDetails. + The Autonomous Database clone type. + + + :param clone_type: The clone_type of this CreateAutonomousDatabaseFromBackupDetails. + :type: str + """ + allowed_values = ["FULL", "METADATA"] + if not value_allowed_none_or_none_sentinel(clone_type, allowed_values): + raise ValueError( + "Invalid value for `clone_type`, must be None or one of {0}" + .format(allowed_values) + ) + self._clone_type = clone_type + + 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/database/models/create_autonomous_database_from_backup_timestamp_details.py b/src/oci/database/models/create_autonomous_database_from_backup_timestamp_details.py new file mode 100644 index 0000000000..904e060b68 --- /dev/null +++ b/src/oci/database/models/create_autonomous_database_from_backup_timestamp_details.py @@ -0,0 +1,276 @@ +# coding: utf-8 +# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + +from .create_autonomous_database_base import CreateAutonomousDatabaseBase +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class CreateAutonomousDatabaseFromBackupTimestampDetails(CreateAutonomousDatabaseBase): + """ + Details to create a point-in-time clone of an Oracle Autonomous Database by specifying a timestamp. Point-in-time clones use backups as the source of the data for the clone. + """ + + #: A constant which can be used with the clone_type property of a CreateAutonomousDatabaseFromBackupTimestampDetails. + #: This constant has a value of "FULL" + CLONE_TYPE_FULL = "FULL" + + #: A constant which can be used with the clone_type property of a CreateAutonomousDatabaseFromBackupTimestampDetails. + #: This constant has a value of "METADATA" + CLONE_TYPE_METADATA = "METADATA" + + def __init__(self, **kwargs): + """ + Initializes a new CreateAutonomousDatabaseFromBackupTimestampDetails object with values from keyword arguments. The default value of the :py:attr:`~oci.database.models.CreateAutonomousDatabaseFromBackupTimestampDetails.source` attribute + of this class is ``BACKUP_FROM_TIMESTAMP`` and it should not be changed. + 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 CreateAutonomousDatabaseFromBackupTimestampDetails. + :type compartment_id: str + + :param db_name: + The value to assign to the db_name property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type db_name: str + + :param cpu_core_count: + The value to assign to the cpu_core_count property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type cpu_core_count: int + + :param db_workload: + The value to assign to the db_workload property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + Allowed values for this property are: "OLTP", "DW" + :type db_workload: str + + :param data_storage_size_in_tbs: + The value to assign to the data_storage_size_in_tbs property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type data_storage_size_in_tbs: int + + :param is_free_tier: + The value to assign to the is_free_tier property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type is_free_tier: bool + + :param admin_password: + The value to assign to the admin_password property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type admin_password: str + + :param display_name: + The value to assign to the display_name property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type display_name: str + + :param license_model: + The value to assign to the license_model property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + Allowed values for this property are: "LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE" + :type license_model: str + + :param is_preview_version_with_service_terms_accepted: + The value to assign to the is_preview_version_with_service_terms_accepted property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type is_preview_version_with_service_terms_accepted: bool + + :param is_auto_scaling_enabled: + The value to assign to the is_auto_scaling_enabled property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type is_auto_scaling_enabled: bool + + :param is_dedicated: + The value to assign to the is_dedicated property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type is_dedicated: bool + + :param autonomous_container_database_id: + The value to assign to the autonomous_container_database_id property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type autonomous_container_database_id: str + + :param whitelisted_ips: + The value to assign to the whitelisted_ips property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type whitelisted_ips: list[str] + + :param freeform_tags: + The value to assign to the freeform_tags property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type freeform_tags: dict(str, str) + + :param defined_tags: + The value to assign to the defined_tags property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type defined_tags: dict(str, dict(str, object)) + + :param source: + The value to assign to the source property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + Allowed values for this property are: "NONE", "DATABASE", "BACKUP_FROM_ID", "BACKUP_FROM_TIMESTAMP" + :type source: str + + :param autonomous_database_id: + The value to assign to the autonomous_database_id property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type autonomous_database_id: str + + :param timestamp: + The value to assign to the timestamp property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type timestamp: datetime + + :param clone_type: + The value to assign to the clone_type property of this CreateAutonomousDatabaseFromBackupTimestampDetails. + Allowed values for this property are: "FULL", "METADATA" + :type clone_type: str + + """ + self.swagger_types = { + 'compartment_id': 'str', + 'db_name': 'str', + 'cpu_core_count': 'int', + 'db_workload': 'str', + 'data_storage_size_in_tbs': 'int', + 'is_free_tier': 'bool', + 'admin_password': 'str', + 'display_name': 'str', + 'license_model': 'str', + 'is_preview_version_with_service_terms_accepted': 'bool', + 'is_auto_scaling_enabled': 'bool', + 'is_dedicated': 'bool', + 'autonomous_container_database_id': 'str', + 'whitelisted_ips': 'list[str]', + 'freeform_tags': 'dict(str, str)', + 'defined_tags': 'dict(str, dict(str, object))', + 'source': 'str', + 'autonomous_database_id': 'str', + 'timestamp': 'datetime', + 'clone_type': 'str' + } + + self.attribute_map = { + 'compartment_id': 'compartmentId', + 'db_name': 'dbName', + 'cpu_core_count': 'cpuCoreCount', + 'db_workload': 'dbWorkload', + 'data_storage_size_in_tbs': 'dataStorageSizeInTBs', + 'is_free_tier': 'isFreeTier', + 'admin_password': 'adminPassword', + 'display_name': 'displayName', + 'license_model': 'licenseModel', + 'is_preview_version_with_service_terms_accepted': 'isPreviewVersionWithServiceTermsAccepted', + 'is_auto_scaling_enabled': 'isAutoScalingEnabled', + 'is_dedicated': 'isDedicated', + 'autonomous_container_database_id': 'autonomousContainerDatabaseId', + 'whitelisted_ips': 'whitelistedIps', + 'freeform_tags': 'freeformTags', + 'defined_tags': 'definedTags', + 'source': 'source', + 'autonomous_database_id': 'autonomousDatabaseId', + 'timestamp': 'timestamp', + 'clone_type': 'cloneType' + } + + self._compartment_id = None + self._db_name = None + self._cpu_core_count = None + self._db_workload = None + self._data_storage_size_in_tbs = None + self._is_free_tier = None + self._admin_password = None + self._display_name = None + self._license_model = None + self._is_preview_version_with_service_terms_accepted = None + self._is_auto_scaling_enabled = None + self._is_dedicated = None + self._autonomous_container_database_id = None + self._whitelisted_ips = None + self._freeform_tags = None + self._defined_tags = None + self._source = None + self._autonomous_database_id = None + self._timestamp = None + self._clone_type = None + self._source = 'BACKUP_FROM_TIMESTAMP' + + @property + def autonomous_database_id(self): + """ + **[Required]** Gets the autonomous_database_id of this CreateAutonomousDatabaseFromBackupTimestampDetails. + The `OCID`__ of the source Autonomous Database that you will clone to create a new Autonomous Database. + + __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm + + + :return: The autonomous_database_id of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :rtype: str + """ + return self._autonomous_database_id + + @autonomous_database_id.setter + def autonomous_database_id(self, autonomous_database_id): + """ + Sets the autonomous_database_id of this CreateAutonomousDatabaseFromBackupTimestampDetails. + The `OCID`__ of the source Autonomous Database that you will clone to create a new Autonomous Database. + + __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm + + + :param autonomous_database_id: The autonomous_database_id of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type: str + """ + self._autonomous_database_id = autonomous_database_id + + @property + def timestamp(self): + """ + **[Required]** Gets the timestamp of this CreateAutonomousDatabaseFromBackupTimestampDetails. + The timestamp specified for the point-in-time clone of the source Autonomous Database. The timestamp must be in the past. + + + :return: The timestamp of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """ + Sets the timestamp of this CreateAutonomousDatabaseFromBackupTimestampDetails. + The timestamp specified for the point-in-time clone of the source Autonomous Database. The timestamp must be in the past. + + + :param timestamp: The timestamp of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type: datetime + """ + self._timestamp = timestamp + + @property + def clone_type(self): + """ + **[Required]** Gets the clone_type of this CreateAutonomousDatabaseFromBackupTimestampDetails. + The Autonomous Database clone type. + + Allowed values for this property are: "FULL", "METADATA" + + + :return: The clone_type of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :rtype: str + """ + return self._clone_type + + @clone_type.setter + def clone_type(self, clone_type): + """ + Sets the clone_type of this CreateAutonomousDatabaseFromBackupTimestampDetails. + The Autonomous Database clone type. + + + :param clone_type: The clone_type of this CreateAutonomousDatabaseFromBackupTimestampDetails. + :type: str + """ + allowed_values = ["FULL", "METADATA"] + if not value_allowed_none_or_none_sentinel(clone_type, allowed_values): + raise ValueError( + "Invalid value for `clone_type`, must be None or one of {0}" + .format(allowed_values) + ) + self._clone_type = clone_type + + 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/version.py b/src/oci/version.py index 4e86ec671a..b734b307e5 100644 --- a/src/oci/version.py +++ b/src/oci/version.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. -__version__ = "2.10.0" +__version__ = "2.10.1" diff --git a/tests/conftest.py b/tests/conftest.py index 21ecf126cd..cab4846d50 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,9 +19,12 @@ def pytest_addoption(parser): default=oci.config.DEFAULT_PROFILE) parser.addoption("--vcr-record-mode", action="store", default='once', help="Record mode option for VCRpy library.") + parser.addoption("--test-mode", action="store", default='service', help="Test mode: service or mock.") + def pytest_configure(config): test_config_container.vcr_mode = config.getoption("--vcr-record-mode") + test_config_container.test_mode = config.getoption("--test-mode") @pytest.fixture(scope="session") @@ -170,12 +173,18 @@ def testing_service_client(): from .testing_service_client import TestingServiceClient client = TestingServiceClient() - with test_config_container.create_vcr().use_cassette('generated/create_test_service_session.yml'): + if test_config_container.test_mode == 'mock': client.create_session() + else: + with test_config_container.create_vcr().use_cassette('generated/create_test_service_session.yml'): + client.create_session() yield client - with test_config_container.create_vcr().use_cassette('generated/close_test_service_session.yml'): + if test_config_container.test_mode == 'mock': client.end_session() + else: + with test_config_container.create_vcr().use_cassette('generated/close_test_service_session.yml'): + client.end_session() except ImportError: yield None diff --git a/tests/test_config_container.py b/tests/test_config_container.py index 77c6876027..1adeeb26ac 100644 --- a/tests/test_config_container.py +++ b/tests/test_config_container.py @@ -12,6 +12,7 @@ import vcr vcr_mode = None +test_mode = None def using_vcr_with_mock_responses(): diff --git a/tests/testing_service_client.py b/tests/testing_service_client.py index 6867d58bb4..5793706209 100644 --- a/tests/testing_service_client.py +++ b/tests/testing_service_client.py @@ -146,6 +146,12 @@ def validate_result(self, service_name, api_name, container_id, request, oci_res "lang": SERVICE_LANGUAGE } + response_types_keep_data_field_name = ['ListObjects', + 'TerraformVersionCollection', + 'MultipleTransferAppliances', + 'MultipleTransferDevices', + 'MultipleTransferPackages'] + if not service_error: if is_paginated_call: # response_class = 'java.util.List'.format(java_package_name=java_package_name, api_name=api_name) @@ -155,13 +161,24 @@ def validate_result(self, service_name, api_name, container_id, request, oci_res response_json = util.make_dict_keys_camel_case(list_responses) else: oci_response = oci_responses[0] - if api_name.lower().startswith('list'): + response_type = oci_response.request.response_type + is_list_api = api_name.lower().startswith('list') + if is_list_api or (response_type and response_type.startswith('list[') and response_type.endswith('Summary]')): + # Hack alert for object storage and resource manager! + if response_type and response_type not in response_types_keep_data_field_name: + data_field_name = 'items' + # For BatchServiceClient#get_job_log() + elif response_type in ['str', 'bytes']: + data_field_name = 'value' + # For StreamClient#get_messages(), which is not considered a paginated call (no page param) + elif response_type in ['list[Message]', 'list[MetricData]']: data_field_name = 'items' response_dict = self.get_response_dictionary(oci_response, is_delete_operation, data_field_name) response_json = util.make_dict_keys_camel_case(response_dict, ['freeformTags', 'definedTags', 'metadata']) data['responseJson'] = json.dumps(response_json) data['responseClass'] = response_class + print('dataToValidate: {}'.format(json.dumps(data, indent=2))) response = requests.post(success_url, params=params, data=json.dumps(data)) else: error = {} @@ -185,17 +202,31 @@ def validate_result(self, service_name, api_name, container_id, request, oci_res def get_response_dictionary(self, oci_response, is_delete_operation, data_field_name): if is_delete_operation: oci_response.data = {} - + print('data field name is ' + data_field_name) if data_field_name == 'stream': # for binary data, decode them first then put into inputStream - response_dict = {"inputStream": str(base64.b64encode(oci_response.data.content).decode('utf-8')), - "contentLength": len(oci_response.data.content)} + response_dict = {"inputStream": str(base64.b64encode(oci_response.data.content).decode('utf-8'))} + if hasattr(oci_response.data, 'content'): + response_dict['contentLength'] = len(oci_response.data.content) + elif data_field_name == 'value': + # for value field (originally str or binary), decode to string + try: + val = oci_response.data.decode('utf-8') + except (UnicodeDecodeError, AttributeError): + val = oci_response.data + response_dict = oci_util.to_dict({data_field_name: val}) else: response_dict = oci_util.to_dict({data_field_name: oci_response.data}) - # response_dict = oci_util.to_dict({data_field_name: oci_response.data}) - response_dict['opcRequestId'] = self.build_request_id() - response_dict['opcNextPage'] = oci_response.next_page + response_dict['opcRequestId'] = oci_response.request_id + if oci_response.next_page is not None: + response_dict['opcNextPage'] = oci_response.next_page + if 'opc-prev-page' in oci_response.headers: + response_dict['opcPrevPage'] = oci_response.headers['opc-prev-page'] + if 'opc-previous-page' in oci_response.headers: + response_dict['opcPreviousPage'] = oci_response.headers['opc-previous-page'] + if 'opc-next-cursor' in oci_response.headers: + response_dict['opcNextCursor'] = oci_response.headers['opc-next-cursor'] work_request_id = 'opc-work-request-id' if work_request_id in oci_response.headers: