From a2f3fe1eb73174b3a3bb7e08586e44eb1c4becaf Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Wed, 31 Jul 2019 15:41:51 -0700 Subject: [PATCH] Revert "Remove docdb mgmt package from master (#6585)" This reverts commit d2ed7d87997eac9b715ee9802c15349a12446b84. --- sdk/cosmos/azure-mgmt-documentdb/HISTORY.rst | 24 + sdk/cosmos/azure-mgmt-documentdb/MANIFEST.in | 2 + sdk/cosmos/azure-mgmt-documentdb/README.rst | 52 + .../azure-mgmt-documentdb/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/documentdb/__init__.py | 18 + .../azure/mgmt/documentdb/document_db.py | 83 ++ .../azure/mgmt/documentdb/models/__init__.py | 52 + .../documentdb/models/consistency_policy.py | 50 + .../documentdb/models/database_account.py | 117 +++ .../database_account_connection_string.py | 39 + ...tabase_account_create_update_parameters.py | 90 ++ ..._account_list_connection_strings_result.py | 29 + .../database_account_list_keys_result.py | 53 + ...base_account_list_read_only_keys_result.py | 41 + .../models/database_account_paged.py | 27 + .../database_account_patch_parameters.py | 31 + ...abase_account_regenerate_key_parameters.py | 33 + .../documentdb/models/document_db_enums.py | 41 + .../documentdb/models/failover_policies.py | 28 + .../mgmt/documentdb/models/failover_policy.py | 48 + .../azure/mgmt/documentdb/models/location.py | 58 ++ .../azure/mgmt/documentdb/models/resource.py | 54 ++ .../mgmt/documentdb/operations/__init__.py | 16 + .../database_accounts_operations.py | 918 ++++++++++++++++++ .../azure/mgmt/documentdb/version.py | 13 + .../azure_bdist_wheel.py | 54 ++ sdk/cosmos/azure-mgmt-documentdb/build.json | 5 + .../dev_requirements.txt | 1 + .../azure-mgmt-documentdb/sdk_packaging.toml | 2 + sdk/cosmos/azure-mgmt-documentdb/setup.cfg | 3 + sdk/cosmos/azure-mgmt-documentdb/setup.py | 85 ++ ..._mgmt_documentdb.test_accounts_create.yaml | 193 ++++ ..._mgmt_documentdb.test_accounts_delete.yaml | 467 +++++++++ ...gmt_documentdb.test_accounts_features.yaml | 272 ++++++ .../tests/test_mgmt_documentdb.py | 146 +++ 36 files changed, 3147 insertions(+) create mode 100644 sdk/cosmos/azure-mgmt-documentdb/HISTORY.rst create mode 100644 sdk/cosmos/azure-mgmt-documentdb/MANIFEST.in create mode 100644 sdk/cosmos/azure-mgmt-documentdb/README.rst create mode 100644 sdk/cosmos/azure-mgmt-documentdb/azure/__init__.py create mode 100644 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/__init__.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/__init__.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/document_db.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/__init__.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/consistency_policy.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_connection_string.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_create_update_parameters.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_connection_strings_result.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_keys_result.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_read_only_keys_result.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_paged.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_patch_parameters.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_regenerate_key_parameters.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/document_db_enums.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policies.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policy.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/location.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/resource.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/__init__.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/database_accounts_operations.py create mode 100755 sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/version.py create mode 100644 sdk/cosmos/azure-mgmt-documentdb/azure_bdist_wheel.py create mode 100644 sdk/cosmos/azure-mgmt-documentdb/build.json create mode 100644 sdk/cosmos/azure-mgmt-documentdb/dev_requirements.txt create mode 100644 sdk/cosmos/azure-mgmt-documentdb/sdk_packaging.toml create mode 100644 sdk/cosmos/azure-mgmt-documentdb/setup.cfg create mode 100644 sdk/cosmos/azure-mgmt-documentdb/setup.py create mode 100644 sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_create.yaml create mode 100644 sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_delete.yaml create mode 100644 sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_features.yaml create mode 100644 sdk/cosmos/azure-mgmt-documentdb/tests/test_mgmt_documentdb.py diff --git a/sdk/cosmos/azure-mgmt-documentdb/HISTORY.rst b/sdk/cosmos/azure-mgmt-documentdb/HISTORY.rst new file mode 100644 index 000000000000..eb7345b4071e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/HISTORY.rst @@ -0,0 +1,24 @@ +.. :changelog: + +Release History +=============== + +0.1.3 (2017-05-02) +++++++++++++++++++ + +* Added property enableAutomaticFailover and consistencyPolicy ConsistentPrefix + +0.1.2 (2017-04-20) +++++++++++++++++++ + +This wheel package is now built with the azure wheel extension + +0.1.1 (2017-03-21) +++++++++++++++++++ + +* Added support for listing database account connection strings + +0.1.0 (2017-01-31) +++++++++++++++++++ + +* Initial Release diff --git a/sdk/cosmos/azure-mgmt-documentdb/MANIFEST.in b/sdk/cosmos/azure-mgmt-documentdb/MANIFEST.in new file mode 100644 index 000000000000..9ecaeb15de50 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/MANIFEST.in @@ -0,0 +1,2 @@ +include *.rst +include azure_bdist_wheel.py \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-documentdb/README.rst b/sdk/cosmos/azure-mgmt-documentdb/README.rst new file mode 100644 index 000000000000..a5204ea75358 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/README.rst @@ -0,0 +1,52 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure DocumentDB Management Client Library. + +Azure Resource Manager (ARM) is the next generation of management APIs that +replace the old Azure Service Management (ASM). + +This package has been tested with Python 2.7, 3.3, 3.4, 3.5 and 3.6. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `azure `__ bundle package. + + +Compatibility +============= + +**IMPORTANT**: If you have an earlier version of the azure package +(version < 1.0), you should uninstall it before installing this package. + +You can check the version using pip: + +.. code:: shell + + pip freeze + +If you see azure==0.11.0 (or any version below 1.0), uninstall it first: + +.. code:: shell + + pip uninstall azure + + +Usage +===== + +For code examples, see `DocumentDB Management +`__ +on readthedocs.org. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. + + +.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-documentdb%2FREADME.png diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/__init__.py b/sdk/cosmos/azure-mgmt-documentdb/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/__init__.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/__init__.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/__init__.py new file mode 100755 index 000000000000..3ec900145f1e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .document_db import DocumentDB +from .version import VERSION + +__all__ = ['DocumentDB'] + +__version__ = VERSION + diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/document_db.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/document_db.py new file mode 100755 index 000000000000..5eda44ab3e32 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/document_db.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import ServiceClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.database_accounts_operations import DatabaseAccountsOperations +from . import models + + +class DocumentDBConfiguration(AzureConfiguration): + """Configuration for DocumentDB + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not isinstance(subscription_id, str): + raise TypeError("Parameter 'subscription_id' must be str.") + if not base_url: + base_url = 'https://management.azure.com' + + super(DocumentDBConfiguration, self).__init__(base_url) + + self.add_user_agent('documentdb/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class DocumentDB(object): + """Azure DocumentDB Database Service Resource Provider REST API + + :ivar config: Configuration for client. + :vartype config: DocumentDBConfiguration + + :ivar database_accounts: DatabaseAccounts operations + :vartype database_accounts: azure.mgmt.documentdb.operations.DatabaseAccountsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = DocumentDBConfiguration(credentials, subscription_id, base_url) + self._client = ServiceClient(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2015-04-08' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.database_accounts = DatabaseAccountsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/__init__.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/__init__.py new file mode 100755 index 000000000000..2ed68c568a84 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/__init__.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .consistency_policy import ConsistencyPolicy +from .location import Location +from .failover_policy import FailoverPolicy +from .database_account import DatabaseAccount +from .failover_policies import FailoverPolicies +from .resource import Resource +from .database_account_create_update_parameters import DatabaseAccountCreateUpdateParameters +from .database_account_patch_parameters import DatabaseAccountPatchParameters +from .database_account_list_read_only_keys_result import DatabaseAccountListReadOnlyKeysResult +from .database_account_list_keys_result import DatabaseAccountListKeysResult +from .database_account_connection_string import DatabaseAccountConnectionString +from .database_account_list_connection_strings_result import DatabaseAccountListConnectionStringsResult +from .database_account_regenerate_key_parameters import DatabaseAccountRegenerateKeyParameters +from .database_account_paged import DatabaseAccountPaged +from .document_db_enums import ( + DatabaseAccountKind, + DatabaseAccountOfferType, + DefaultConsistencyLevel, + KeyKind, +) + +__all__ = [ + 'ConsistencyPolicy', + 'Location', + 'FailoverPolicy', + 'DatabaseAccount', + 'FailoverPolicies', + 'Resource', + 'DatabaseAccountCreateUpdateParameters', + 'DatabaseAccountPatchParameters', + 'DatabaseAccountListReadOnlyKeysResult', + 'DatabaseAccountListKeysResult', + 'DatabaseAccountConnectionString', + 'DatabaseAccountListConnectionStringsResult', + 'DatabaseAccountRegenerateKeyParameters', + 'DatabaseAccountPaged', + 'DatabaseAccountKind', + 'DatabaseAccountOfferType', + 'DefaultConsistencyLevel', + 'KeyKind', +] diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/consistency_policy.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/consistency_policy.py new file mode 100755 index 000000000000..d8cefd4c0b59 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/consistency_policy.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConsistencyPolicy(Model): + """The consistency policy for the DocumentDB database account. + + :param default_consistency_level: The default consistency level and + configuration settings of the DocumentDB account. Possible values include: + 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix' + :type default_consistency_level: str or :class:`DefaultConsistencyLevel + ` + :param max_staleness_prefix: When used with the Bounded Staleness + consistency level, this value represents the number of stale requests + tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_staleness_prefix: long + :param max_interval_in_seconds: When used with the Bounded Staleness + consistency level, this value represents the time amount of staleness (in + seconds) tolerated. Accepted range for this value is 1 - 100. Required + when defaultConsistencyPolicy is set to 'BoundedStaleness'. + :type max_interval_in_seconds: int + """ + + _validation = { + 'default_consistency_level': {'required': True}, + 'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1}, + 'max_interval_in_seconds': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'}, + 'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'}, + 'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, default_consistency_level, max_staleness_prefix=None, max_interval_in_seconds=None): + self.default_consistency_level = default_consistency_level + self.max_staleness_prefix = max_staleness_prefix + self.max_interval_in_seconds = max_interval_in_seconds diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account.py new file mode 100755 index 000000000000..89031adc35cb --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class DatabaseAccount(Resource): + """A DocumentDB database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or :class:`DatabaseAccountKind + ` + :param provisioning_state: + :type provisioning_state: str + :ivar document_endpoint: The connection endpoint for the DocumentDB + database account. + :vartype document_endpoint: str + :ivar database_account_offer_type: The offer type for the DocumentDB + database account. Default value: Standard. Possible values include: + 'Standard' + :vartype database_account_offer_type: str or + :class:`DatabaseAccountOfferType + ` + :param ip_range_filter: DocumentDB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + :param consistency_policy: The consistency policy for the DocumentDB + database account. + :type consistency_policy: :class:`ConsistencyPolicy + ` + :ivar write_locations: An array that contains the write location for the + DocumentDB account. + :vartype write_locations: list of :class:`Location + ` + :ivar read_locations: An array that contains of the read locations enabled + for the DocumentDB account. + :vartype read_locations: list of :class:`Location + ` + :ivar failover_policies: An array that contains the regions ordered by + their failover priorities. + :vartype failover_policies: list of :class:`FailoverPolicy + ` + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'document_endpoint': {'readonly': True}, + 'database_account_offer_type': {'readonly': True}, + 'write_locations': {'readonly': True}, + 'read_locations': {'readonly': True}, + 'failover_policies': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'}, + 'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'}, + 'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, location, tags=None, kind="GlobalDocumentDB", provisioning_state=None, ip_range_filter=None, enable_automatic_failover=None, consistency_policy=None): + super(DatabaseAccount, self).__init__(location=location, tags=tags) + self.kind = kind + self.provisioning_state = provisioning_state + self.document_endpoint = None + self.database_account_offer_type = None + self.ip_range_filter = ip_range_filter + self.enable_automatic_failover = enable_automatic_failover + self.consistency_policy = consistency_policy + self.write_locations = None + self.read_locations = None + self.failover_policies = None diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_connection_string.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_connection_string.py new file mode 100755 index 000000000000..db1828208069 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_connection_string.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DatabaseAccountConnectionString(Model): + """Connection string for the DocumentDB account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connection_string: Value of the connection string + :vartype connection_string: str + :ivar description: Description of the connection string + :vartype description: str + """ + + _validation = { + 'connection_string': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self): + self.connection_string = None + self.description = None diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_create_update_parameters.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_create_update_parameters.py new file mode 100755 index 000000000000..30978f482f0b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_create_update_parameters.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class DatabaseAccountCreateUpdateParameters(Resource): + """Parameters to create and update DocumentDB database accounts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict + :param kind: Indicates the type of database account. This can only be set + at database account creation. Possible values include: 'GlobalDocumentDB', + 'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" . + :type kind: str or :class:`DatabaseAccountKind + ` + :param consistency_policy: The consistency policy for the DocumentDB + account. + :type consistency_policy: :class:`ConsistencyPolicy + ` + :param locations: An array that contains the georeplication locations + enabled for the DocumentDB account. + :type locations: list of :class:`Location + ` + :ivar database_account_offer_type: Default value: "Standard" . + :vartype database_account_offer_type: str + :param ip_range_filter: DocumentDB Firewall Support: This value specifies + the set of IP addresses or IP address ranges in CIDR form to be included + as the allowed list of client IPs for a given database account. IP + addresses/ranges must be comma separated and must not contain any spaces. + :type ip_range_filter: str + :param enable_automatic_failover: Enables automatic failover of the write + region in the rare event that the region is unavailable due to an outage. + Automatic failover will result in a new write region for the account and + is chosen based on the failover priorities configured for the account. + :type enable_automatic_failover: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'locations': {'required': True}, + 'database_account_offer_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'}, + 'locations': {'key': 'properties.locations', 'type': '[Location]'}, + 'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'str'}, + 'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'}, + 'enable_automatic_failover': {'key': 'properties.enableAutomaticFailover', 'type': 'bool'}, + } + + database_account_offer_type = "Standard" + + def __init__(self, location, locations, tags=None, kind="GlobalDocumentDB", consistency_policy=None, ip_range_filter=None, enable_automatic_failover=None): + super(DatabaseAccountCreateUpdateParameters, self).__init__(location=location, tags=tags) + self.kind = kind + self.consistency_policy = consistency_policy + self.locations = locations + self.ip_range_filter = ip_range_filter + self.enable_automatic_failover = enable_automatic_failover diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_connection_strings_result.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_connection_strings_result.py new file mode 100755 index 000000000000..7cddc00a3de1 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_connection_strings_result.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DatabaseAccountListConnectionStringsResult(Model): + """The connection strings for the given database account. + + :param connection_strings: An array that contains the connection strings + for the DocumentDB account. + :type connection_strings: list of :class:`DatabaseAccountConnectionString + ` + """ + + _attribute_map = { + 'connection_strings': {'key': 'connectionStrings', 'type': '[DatabaseAccountConnectionString]'}, + } + + def __init__(self, connection_strings=None): + self.connection_strings = connection_strings diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_keys_result.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_keys_result.py new file mode 100755 index 000000000000..4d775054ac14 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_keys_result.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DatabaseAccountListKeysResult(Model): + """The access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_master_key: Base 64 encoded value of the primary read-write + key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary + read-write key. + :vartype secondary_master_key: str + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_master_key': {'readonly': True}, + 'secondary_master_key': {'readonly': True}, + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'}, + 'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'}, + 'primary_readonly_master_key': {'key': 'properties.primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'properties.secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self): + self.primary_master_key = None + self.secondary_master_key = None + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_read_only_keys_result.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_read_only_keys_result.py new file mode 100755 index 000000000000..3330353950c6 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_list_read_only_keys_result.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DatabaseAccountListReadOnlyKeysResult(Model): + """The read-only access keys for the given database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary + read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the + secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + _validation = { + 'primary_readonly_master_key': {'readonly': True}, + 'secondary_readonly_master_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'}, + 'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'}, + } + + def __init__(self): + self.primary_readonly_master_key = None + self.secondary_readonly_master_key = None diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_paged.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_paged.py new file mode 100755 index 000000000000..4cb94909c515 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class DatabaseAccountPaged(Paged): + """ + A paging container for iterating over a list of DatabaseAccount object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DatabaseAccount]'} + } + + def __init__(self, *args, **kwargs): + + super(DatabaseAccountPaged, self).__init__(*args, **kwargs) diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_patch_parameters.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_patch_parameters.py new file mode 100755 index 000000000000..be78a4fd6817 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_patch_parameters.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DatabaseAccountPatchParameters(Model): + """Parameters for patching Azure DocumentDB database account properties. + + :param tags: + :type tags: dict + """ + + _validation = { + 'tags': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, tags): + self.tags = tags diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_regenerate_key_parameters.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_regenerate_key_parameters.py new file mode 100755 index 000000000000..3bff90d33db3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account_regenerate_key_parameters.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DatabaseAccountRegenerateKeyParameters(Model): + """Parameters to regenerate the keys within the database account. + + :param key_kind: The access key to regenerate. Possible values include: + 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + :type key_kind: str or :class:`KeyKind + ` + """ + + _validation = { + 'key_kind': {'required': True}, + } + + _attribute_map = { + 'key_kind': {'key': 'keyKind', 'type': 'str'}, + } + + def __init__(self, key_kind): + self.key_kind = key_kind diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/document_db_enums.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/document_db_enums.py new file mode 100755 index 000000000000..1e87cecaeb2a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/document_db_enums.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class DatabaseAccountKind(Enum): + + global_document_db = "GlobalDocumentDB" + mongo_db = "MongoDB" + parse = "Parse" + + +class DatabaseAccountOfferType(Enum): + + standard = "Standard" + + +class DefaultConsistencyLevel(Enum): + + eventual = "Eventual" + session = "Session" + bounded_staleness = "BoundedStaleness" + strong = "Strong" + consistent_prefix = "ConsistentPrefix" + + +class KeyKind(Enum): + + primary = "primary" + secondary = "secondary" + primary_readonly = "primaryReadonly" + secondary_readonly = "secondaryReadonly" diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policies.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policies.py new file mode 100755 index 000000000000..4c3ebff5e3b5 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policies.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class FailoverPolicies(Model): + """The list of new failover policies for the failover priority change. + + :param failover_policies: List of failover policies. + :type failover_policies: list of :class:`FailoverPolicy + ` + """ + + _attribute_map = { + 'failover_policies': {'key': 'failoverPolicies', 'type': '[FailoverPolicy]'}, + } + + def __init__(self, failover_policies=None): + self.failover_policies = failover_policies diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policy.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policy.py new file mode 100755 index 000000000000..99cc2769403b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/failover_policy.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class FailoverPolicy(Model): + """The failover policy for a given region of a database account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region in which the database + account replicates to. Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region in which the database account + exists. + :type location_name: str + :param failover_priority: The failover priority of the region. A failover + priority of 0 indicates a write region. The maximum value for a failover + priority = (total number of regions - 1). Failover priority values must be + unique for each of the regions in which the database account exists. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, location_name=None, failover_priority=None): + self.id = None + self.location_name = location_name + self.failover_priority = failover_priority diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/location.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/location.py new file mode 100755 index 000000000000..8bc82bde2c3f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/location.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Location(Model): + """A region in which the Azure DocumentDB database account is deployed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique identifier of the region within the database account. + Example: <accountName>-<locationName>. + :vartype id: str + :param location_name: The name of the region. + :type location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. + Example: + https://<accountName>-<locationName>.documents.azure.com:443/ + :vartype document_endpoint: str + :param provisioning_state: + :type provisioning_state: str + :param failover_priority: The failover priority of the region. A failover + priority of 0 indicates a write region. The maximum value for a failover + priority = (total number of regions - 1). Failover priority values must be + unique for each of the regions in which the database account exists. + :type failover_priority: int + """ + + _validation = { + 'id': {'readonly': True}, + 'document_endpoint': {'readonly': True}, + 'failover_priority': {'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_name': {'key': 'locationName', 'type': 'str'}, + 'document_endpoint': {'key': 'documentEndpoint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'failover_priority': {'key': 'failoverPriority', 'type': 'int'}, + } + + def __init__(self, location_name=None, provisioning_state=None, failover_priority=None): + self.id = None + self.location_name = location_name + self.document_endpoint = None + self.provisioning_state = provisioning_state + self.failover_priority = failover_priority diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/resource.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/resource.py new file mode 100755 index 000000000000..d5e887d0b78a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/resource.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Resource(Model): + """A database account resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The unique resource identifier of the database account. + :vartype id: str + :ivar name: The name of the database account. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :param location: The location of the resource group to which the resource + belongs. + :type location: str + :param tags: + :type tags: dict + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, location, tags=None): + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/__init__.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/__init__.py new file mode 100755 index 000000000000..27ed7c069537 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .database_accounts_operations import DatabaseAccountsOperations + +__all__ = [ + 'DatabaseAccountsOperations', +] diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/database_accounts_operations.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/database_accounts_operations.py new file mode 100755 index 000000000000..2bb39b1f6839 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/operations/database_accounts_operations.py @@ -0,0 +1,918 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrestazure.azure_operation import AzureOperationPoller +import uuid + +from .. import models + + +class DatabaseAccountsOperations(object): + """DatabaseAccountsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2015-04-08. Constant value: "2015-04-08". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-04-08" + + self.config = config + + def get( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Retrieves the properties of an existing Azure DocumentDB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`DatabaseAccount + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def patch( + self, resource_group_name, account_name, tags, custom_headers=None, raw=False, **operation_config): + """Patches the properties of an existing Azure DocumentDB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param tags: + :type tags: dict + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`DatabaseAccount + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + update_parameters = models.DatabaseAccountPatchParameters(tags=tags) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_parameters, 'DatabaseAccountPatchParameters') + + # Construct and send request + def long_running_send(): + + request = self._client.patch(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def create_or_update( + self, resource_group_name, account_name, create_update_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an Azure DocumentDB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param create_update_parameters: The parameters to provide for the + current database account. + :type create_update_parameters: + :class:`DatabaseAccountCreateUpdateParameters + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`DatabaseAccount + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_update_parameters, 'DatabaseAccountCreateUpdateParameters') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def delete( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Deletes an existing Azure DocumentDB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns None + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + def long_running_send(): + + request = self._client.delete(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def failover_priority_change( + self, resource_group_name, account_name, failover_policies=None, custom_headers=None, raw=False, **operation_config): + """Changes the failover priority for the Azure DocumentDB database + account. A failover priority of 0 indicates a write region. The maximum + value for a failover priority = (total number of regions - 1). Failover + priority values must be unique for each of the regions in which the + database account exists. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param failover_policies: List of failover policies. + :type failover_policies: list of :class:`FailoverPolicy + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns None + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + failover_parameters = models.FailoverPolicies(failover_policies=failover_policies) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(failover_parameters, 'FailoverPolicies') + + # Construct and send request + def long_running_send(): + + request = self._client.post(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure DocumentDB database accounts available under the + subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`DatabaseAccountPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all the Azure DocumentDB database accounts available under the + given resource group. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`DatabaseAccountPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DatabaseAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def list_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the access keys for the specified Azure DocumentDB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`DatabaseAccountListKeysResult + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_connection_strings( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the connection strings for the specified Azure DocumentDB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`DatabaseAccountListConnectionStringsResult + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListConnectionStringsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_read_only_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the read-only access keys for the specified Azure DocumentDB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`DatabaseAccountListReadOnlyKeysResult + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAccountListReadOnlyKeysResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def regenerate_key( + self, resource_group_name, account_name, key_kind, custom_headers=None, raw=False, **operation_config): + """Regenerates an access key for the specified Azure DocumentDB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: DocumentDB database account name. + :type account_name: str + :param key_kind: The access key to regenerate. Possible values + include: 'primary', 'secondary', 'primaryReadonly', + 'secondaryReadonly' + :type key_kind: str or :class:`KeyKind + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns None + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + key_to_regenerate = models.DatabaseAccountRegenerateKeyParameters(key_kind=key_kind) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern='^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(key_to_regenerate, 'DatabaseAccountRegenerateKeyParameters') + + # Construct and send request + def long_running_send(): + + request = self._client.post(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def check_name_exists( + self, account_name, custom_headers=None, raw=False, **operation_config): + """Checks that the Azure DocumentDB account name already exists. A valid + account name may contain only lowercase letters, numbers, and the '-' + character, and must be between 3 and 50 characters. + + :param account_name: DocumentDB database account name. + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: bool + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}' + path_format_arguments = { + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 404]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = (response.status_code == 200) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + return deserialized diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/version.py b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/version.py new file mode 100755 index 000000000000..95ed79d29108 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.3" + diff --git a/sdk/cosmos/azure-mgmt-documentdb/azure_bdist_wheel.py b/sdk/cosmos/azure-mgmt-documentdb/azure_bdist_wheel.py new file mode 100644 index 000000000000..8a81d1b61775 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/azure_bdist_wheel.py @@ -0,0 +1,54 @@ +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from distutils import log as logger +import os.path + +from wheel.bdist_wheel import bdist_wheel +class azure_bdist_wheel(bdist_wheel): + """The purpose of this class is to build wheel a little differently than the sdist, + without requiring to build the wheel from the sdist (i.e. you can build the wheel + directly from source). + """ + + description = "Create an Azure wheel distribution" + + user_options = bdist_wheel.user_options + \ + [('azure-namespace-package=', None, + "Name of the deepest nspkg used")] + + def initialize_options(self): + bdist_wheel.initialize_options(self) + self.azure_namespace_package = None + + def finalize_options(self): + bdist_wheel.finalize_options(self) + if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): + raise ValueError("azure_namespace_package must finish by -nspkg") + + def run(self): + if not self.distribution.install_requires: + self.distribution.install_requires = [] + self.distribution.install_requires.append( + "{}>=2.0.0".format(self.azure_namespace_package)) + bdist_wheel.run(self) + + def write_record(self, bdist_dir, distinfo_dir): + if self.azure_namespace_package: + # Split and remove last part, assuming it's "nspkg" + subparts = self.azure_namespace_package.split('-')[0:-1] + folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] + for azure_sub_package in folder_with_init: + init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') + if os.path.isfile(init_file): + logger.info("manually remove {} while building the wheel".format(init_file)) + os.remove(init_file) + else: + raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) + bdist_wheel.write_record(self, bdist_dir, distinfo_dir) +cmdclass = { + 'bdist_wheel': azure_bdist_wheel, +} diff --git a/sdk/cosmos/azure-mgmt-documentdb/build.json b/sdk/cosmos/azure-mgmt-documentdb/build.json new file mode 100644 index 000000000000..4d98fc12a39e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/build.json @@ -0,0 +1,5 @@ +{ + "autorest": "1.0.1-20170501-2300-nightly", + "date": "2017-05-01T20:13:42Z", + "version": "0.1.3" +} \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-documentdb/dev_requirements.txt b/sdk/cosmos/azure-mgmt-documentdb/dev_requirements.txt new file mode 100644 index 000000000000..6ccb7f031ddd --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/dev_requirements.txt @@ -0,0 +1 @@ +-e ../../../tools/azure-sdk-tools diff --git a/sdk/cosmos/azure-mgmt-documentdb/sdk_packaging.toml b/sdk/cosmos/azure-mgmt-documentdb/sdk_packaging.toml new file mode 100644 index 000000000000..e7687fdae93b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/sdk_packaging.toml @@ -0,0 +1,2 @@ +[packaging] +auto_update = false \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-documentdb/setup.cfg b/sdk/cosmos/azure-mgmt-documentdb/setup.cfg new file mode 100644 index 000000000000..856f4164982c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal=1 +azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-documentdb/setup.py b/sdk/cosmos/azure-mgmt-documentdb/setup.py new file mode 100644 index 000000000000..ddef54e31bb5 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/setup.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + cmdclass = {} + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-documentdb" +PACKAGE_PPRINT_NAME = "DocumentDB Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + license='MIT License', + author='Microsoft Corporation', + author_email='ptvshelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(), + install_requires=[ + 'msrestazure~=0.4.7', + 'azure-common~=1.1.5', + ], + cmdclass=cmdclass +) diff --git a/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_create.yaml b/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_create.yaml new file mode 100644 index 000000000000..d470d7f8673d --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_create.yaml @@ -0,0 +1,193 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [ee04e7e4-df68-11e6-8adf-ecb1d756380e] + method: HEAD + uri: https://management.azure.com/providers/Microsoft.DocumentDB/databaseAccountNames/pydocdbtst633610d9?api-version=2015-04-08 + response: + body: {string: ''} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['142'] + Date: ['Fri, 20 Jan 2017 23:34:04 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [de835205-e886-4a4b-b113-1d9aa4058abf] + x-ms-ratelimit-remaining-tenant-reads: ['14999'] + x-ms-request-id: [de835205-e886-4a4b-b113-1d9aa4058abf] + x-ms-routing-request-id: ['WESTUS2:20170120T233404Z:de835205-e886-4a4b-b113-1d9aa4058abf'] + status: {code: 404, message: NotFound} +- request: + body: '{"location": "westus", "properties": {"locations": [{"locationName": "westus"}], + "databaseAccountOfferType": "Standard"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['121'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [ee5bccc6-df68-11e6-9757-ecb1d756380e] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9?api-version=2015-04-08 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9","name":"pydocdbtst633610d9","location":"West + US","type":"Microsoft.DocumentDB/databaseAccounts","kind":"GlobalDocumentDB","tags":{},"properties":{"provisioningState":"Initializing","ipRangeFilter":"","databaseAccountOfferType":"Standard","consistencyPolicy":{"defaultConsistencyLevel":"Session","maxIntervalInSeconds":5,"maxStalenessPrefix":100},"writeLocations":[{"id":"pydocdbtst633610d9-westus","locationName":"West + US","provisioningState":"Initializing","failoverPriority":0}],"readLocations":[{"id":"pydocdbtst633610d9-westus","locationName":"West + US","provisioningState":"Initializing","failoverPriority":0}],"failoverPolicies":[{"id":"pydocdbtst633610d9-westus","locationName":"West + US","failoverPriority":0}]}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:34:06 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['910'] + x-ms-correlation-request-id: [2b6e0aba-5e47-4ff4-8ee4-b1d07ea42ac2] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-request-id: [166b85c6-9a92-4a6a-bea6-5e0efaf2fe68] + x-ms-routing-request-id: ['WESTUS2:20170120T233406Z:2b6e0aba-5e47-4ff4-8ee4-b1d07ea42ac2'] + status: {code: 200, message: Ok} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [ee5bccc6-df68-11e6-9757-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:34:36 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [a77929e1-2fa1-43c4-ab70-b5554663bbef] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [166b85c6-9a92-4a6a-bea6-5e0efaf2fe68] + x-ms-routing-request-id: ['WESTUS2:20170120T233437Z:a77929e1-2fa1-43c4-ab70-b5554663bbef'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [ee5bccc6-df68-11e6-9757-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:35:07 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [3b823538-b756-42f5-ab5a-984fcb0784e9] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [166b85c6-9a92-4a6a-bea6-5e0efaf2fe68] + x-ms-routing-request-id: ['CENTRALUS:20170120T233507Z:3b823538-b756-42f5-ab5a-984fcb0784e9'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [ee5bccc6-df68-11e6-9757-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:35:37 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [688431b3-6581-4d37-97c6-f31ec251c7f5] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [166b85c6-9a92-4a6a-bea6-5e0efaf2fe68] + x-ms-routing-request-id: ['CENTRALUS:20170120T233538Z:688431b3-6581-4d37-97c6-f31ec251c7f5'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [ee5bccc6-df68-11e6-9757-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08 + response: + body: {string: '{"status":"Completed","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_create633610d9/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtst633610d9/operationResults/166b85c6-9a92-4a6a-bea6-5e0efaf2fe68?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:36:08 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['33'] + x-ms-correlation-request-id: [92158f40-6108-4371-8e11-481bfab5290d] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14997'] + x-ms-request-id: [92158f40-6108-4371-8e11-481bfab5290d] + x-ms-routing-request-id: ['WESTUS2:20170120T233609Z:92158f40-6108-4371-8e11-481bfab5290d'] + status: {code: 200, message: Ok} +version: 1 diff --git a/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_delete.yaml b/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_delete.yaml new file mode 100644 index 000000000000..e6f4e2348f8f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_delete.yaml @@ -0,0 +1,467 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8?api-version=2015-04-08 + response: + body: {string: '{"status":"Enqueued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:26:52 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [3a704aa4-486b-4231-b95d-f778b23a86f0] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['WESTUS2:20170120T232652Z:3a704aa4-486b-4231-b95d-f778b23a86f0'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:27:22 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [1367d949-a5ed-4098-b4de-95c182fec7de] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['WESTUS2:20170120T232722Z:1367d949-a5ed-4098-b4de-95c182fec7de'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:27:52 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [fe9ceb95-f76c-489d-b74e-c7a99321a2f1] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['WESTUS2:20170120T232752Z:fe9ceb95-f76c-489d-b74e-c7a99321a2f1'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:28:21 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [8f603df8-c522-4f5e-91c7-61cd4a8f6d44] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['WESTUS2:20170120T232822Z:8f603df8-c522-4f5e-91c7-61cd4a8f6d44'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:28:52 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [35596a0f-c028-4a58-ac06-5af8f1326d9b] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['WESTUS2:20170120T232853Z:35596a0f-c028-4a58-ac06-5af8f1326d9b'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:29:23 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [f8a54ad1-961f-4019-9c1c-5af6f66111c4] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['CENTRALUS:20170120T232924Z:f8a54ad1-961f-4019-9c1c-5af6f66111c4'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:29:54 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [5c65ca5c-00b2-4d6a-a0d9-0eb423fe5c72] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['CENTRALUS:20170120T232954Z:5c65ca5c-00b2-4d6a-a0d9-0eb423fe5c72'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:30:24 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [1b5c9b56-d541-41a1-94d0-33363fa5a6a3] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14997'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['CENTRALUS:20170120T233025Z:1b5c9b56-d541-41a1-94d0-33363fa5a6a3'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:30:55 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [695e75e7-3d93-4a5a-bd6c-893b1200af83] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['CENTRALUS:20170120T233055Z:695e75e7-3d93-4a5a-bd6c-893b1200af83'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:31:25 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [7f11cc64-36c6-4b07-be23-4d0e0f4baf14] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['CENTRALUS:20170120T233126Z:7f11cc64-36c6-4b07-be23-4d0e0f4baf14'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:31:56 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [79add0ae-6249-4b40-8831-77b9149cf9c8] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['CENTRALUS:20170120T233156Z:79add0ae-6249-4b40-8831-77b9149cf9c8'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:32:26 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [81e966da-a139-4cc1-8a88-2c75aa9d55fa] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14997'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['CENTRALUS:20170120T233226Z:81e966da-a139-4cc1-8a88-2c75aa9d55fa'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:32:56 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [a0a7285f-196f-4667-8eb9-9f3bac9a6868] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['WESTUS2:20170120T233257Z:a0a7285f-196f-4667-8eb9-9f3bac9a6868'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"status":"Dequeued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:33:28 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [23a882c3-b3a4-4c65-9027-fd38d0cb0833] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [aa3450d5-b368-4741-a59d-b83eb2e98aab] + x-ms-routing-request-id: ['WESTUS2:20170120T233328Z:23a882c3-b3a4-4c65-9027-fd38d0cb0833'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [eb4a2bb4-df67-11e6-b06b-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_delete632310d8/providers/Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8/operationResults/aa3450d5-b368-4741-a59d-b83eb2e98aab?api-version=2015-04-08 + response: + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.DocumentDB/databaseAccounts/pydocumentdbtst632310d8'' + under resource group ''test_mgmt_documentdb_test_accounts_delete632310d8'' + was not found."}}'} + headers: + Cache-Control: [no-cache] + Content-Length: ['214'] + Content-Type: [application/json; charset=utf-8] + Date: ['Fri, 20 Jan 2017 23:33:57 GMT'] + Expires: ['-1'] + Pragma: [no-cache] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [974e9b1b-17f3-4f38-8025-710c32e33a3e] + x-ms-failure-cause: [gateway] + x-ms-request-id: [974e9b1b-17f3-4f38-8025-710c32e33a3e] + x-ms-routing-request-id: ['WESTUS2:20170120T233358Z:974e9b1b-17f3-4f38-8025-710c32e33a3e'] + status: {code: 404, message: Not Found} +version: 1 diff --git a/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_features.yaml b/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_features.yaml new file mode 100644 index 000000000000..b2e4b82a9d9e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/tests/recordings/test_mgmt_documentdb.test_accounts_features.yaml @@ -0,0 +1,272 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [9815b206-df69-11e6-9440-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4?api-version=2015-04-08 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4","name":"pydocdbtest865411c4","location":"West + US","type":"Microsoft.DocumentDB/databaseAccounts","kind":"GlobalDocumentDB","tags":{},"properties":{"provisioningState":"Succeeded","documentEndpoint":"https://pydocdbtest865411c4.documents.azure.com:443/","ipRangeFilter":"","databaseAccountOfferType":"Standard","consistencyPolicy":{"defaultConsistencyLevel":"Session","maxIntervalInSeconds":5,"maxStalenessPrefix":100},"writeLocations":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","documentEndpoint":"https://pydocdbtest865411c4-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"readLocations":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","documentEndpoint":"https://pydocdbtest865411c4-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"failoverPolicies":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","failoverPriority":0}]}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:38:50 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['1144'] + x-ms-correlation-request-id: [2cdea2e5-159c-4b93-81f8-393920f283d0] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14996'] + x-ms-request-id: [2cdea2e5-159c-4b93-81f8-393920f283d0] + x-ms-routing-request-id: ['WESTUS2:20170120T233850Z:2cdea2e5-159c-4b93-81f8-393920f283d0'] + status: {code: 200, message: Ok} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [989fe466-df69-11e6-905d-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts?api-version=2015-04-08 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4","name":"pydocdbtest865411c4","location":"West + US","type":"Microsoft.DocumentDB/databaseAccounts","kind":"GlobalDocumentDB","tags":{},"properties":{"provisioningState":"Succeeded","documentEndpoint":"https://pydocdbtest865411c4.documents.azure.com:443/","ipRangeFilter":"","databaseAccountOfferType":"Standard","consistencyPolicy":{"defaultConsistencyLevel":"Session","maxIntervalInSeconds":5,"maxStalenessPrefix":100},"writeLocations":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","documentEndpoint":"https://pydocdbtest865411c4-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"readLocations":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","documentEndpoint":"https://pydocdbtest865411c4-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"failoverPolicies":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","failoverPriority":0}]}}]}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:38:51 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['1156'] + x-ms-correlation-request-id: [9e8c6d5a-eb2b-4c39-a1d8-ee3bebde6e0d] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14997'] + x-ms-request-id: [9e8c6d5a-eb2b-4c39-a1d8-ee3bebde6e0d] + x-ms-routing-request-id: ['WESTUS2:20170120T233852Z:9e8c6d5a-eb2b-4c39-a1d8-ee3bebde6e0d'] + status: {code: 200, message: Ok} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [99854f92-df69-11e6-bd5a-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/databaseAccounts?api-version=2015-04-08 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4","name":"pydocdbtest865411c4","location":"West + US","type":"Microsoft.DocumentDB/databaseAccounts","kind":"GlobalDocumentDB","tags":{},"properties":{"provisioningState":"Succeeded","documentEndpoint":"https://pydocdbtest865411c4.documents.azure.com:443/","ipRangeFilter":"","databaseAccountOfferType":"Standard","consistencyPolicy":{"defaultConsistencyLevel":"Session","maxIntervalInSeconds":5,"maxStalenessPrefix":100},"writeLocations":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","documentEndpoint":"https://pydocdbtest865411c4-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"readLocations":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","documentEndpoint":"https://pydocdbtest865411c4-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"failoverPolicies":[{"id":"pydocdbtest865411c4-westus","locationName":"West + US","failoverPriority":0}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MonitorTestsDoNotDelete/providers/Microsoft.DocumentDB/databaseAccounts/pymonitortest","name":"pymonitortest","location":"West + US","type":"Microsoft.DocumentDB/databaseAccounts","kind":"GlobalDocumentDB","tags":{},"properties":{"provisioningState":"Succeeded","documentEndpoint":"https://pymonitortest.documents.azure.com:443/","ipRangeFilter":"","databaseAccountOfferType":"Standard","consistencyPolicy":{"defaultConsistencyLevel":"Session","maxIntervalInSeconds":5,"maxStalenessPrefix":100},"writeLocations":[{"id":"pymonitortest-westus","locationName":"West + US","documentEndpoint":"https://pymonitortest-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"readLocations":[{"id":"pymonitortest-westus","locationName":"West + US","documentEndpoint":"https://pymonitortest-westus.documents.azure.com:443/","provisioningState":"Succeeded","failoverPriority":0}],"failoverPolicies":[{"id":"pymonitortest-westus","locationName":"West + US","failoverPriority":0}]}}]}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/databaseAccounts?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:38:53 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['2225'] + x-ms-correlation-request-id: [5392927e-859b-4e7e-b2fa-daa0d18fc56b] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14998'] + x-ms-request-id: [5392927e-859b-4e7e-b2fa-daa0d18fc56b] + x-ms-routing-request-id: ['WESTUS2:20170120T233853Z:5392927e-859b-4e7e-b2fa-daa0d18fc56b'] + status: {code: 200, message: Ok} +- request: + body: '{"failoverPolicies": [{"failoverPriority": 0, "locationName": "westus"}]}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['73'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [9a6594c0-df69-11e6-a509-ecb1d756380e] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/failoverPriorityChange?api-version=2015-04-08 + response: + body: {string: '{"code":"BadRequest","message":"Failover priorities must be unique + and 0 <= priority < (number of failover policies)\r\nActivityId: 9a6594c0-df69-11e6-a509-ecb1d756380e"}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['170'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:38:54 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [2ae1bbe2-bc79-4a01-b79d-68763a6b75a9] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-request-id: [2ae1bbe2-bc79-4a01-b79d-68763a6b75a9] + x-ms-routing-request-id: ['WESTUS2:20170120T233855Z:2ae1bbe2-bc79-4a01-b79d-68763a6b75a9'] + status: {code: 400, message: BadRequest} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [9b3e704a-df69-11e6-9960-ecb1d756380e] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/listKeys?api-version=2015-04-08 + response: + body: {string: '{"primaryMasterKey":"3Df7h2mE2s2WIq251e2ifBJxAu5E1NO80c4cYp5mBBKwk2jJT22YFtcgAG9gkV8Y2r01HF5xfPJdO3WoDHaNDA==","secondaryMasterKey":"TBemTAFWd0LRnqZzzjbQtHmwaw0T7fOm0TKQDx4leaFHcqBiOftHRC9wyGUN1XCVDOvoc3W2Ag8itbX5Pzs8JA==","primaryReadonlyMasterKey":"YdVKJP3JJ4fffFTSa9YuFOGEmVx3KblW8MsNDytFWKKurfa8xU1h8XufE6Z4AZcYMu1LVbS2J2n4dCdDbwvkVQ==","secondaryReadonlyMasterKey":"s8HQlRxk6EfWiXOxoXvEVpK5Um2EOc9zohZpoe6wYDrulyguxaF7iw22j3VZgXXYDCg1gsMngmtmTfmvj3QWLQ=="}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:38:55 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['461'] + x-ms-correlation-request-id: [7cd2d42d-6546-49ea-a107-37f22e802552] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-request-id: [7cd2d42d-6546-49ea-a107-37f22e802552] + x-ms-routing-request-id: ['WESTUS2:20170120T233855Z:7cd2d42d-6546-49ea-a107-37f22e802552'] + status: {code: 200, message: Ok} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [9bb1c630-df69-11e6-935e-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/readonlykeys?api-version=2015-04-08 + response: + body: {string: '{"primaryReadonlyMasterKey":"YdVKJP3JJ4fffFTSa9YuFOGEmVx3KblW8MsNDytFWKKurfa8xU1h8XufE6Z4AZcYMu1LVbS2J2n4dCdDbwvkVQ==","secondaryReadonlyMasterKey":"s8HQlRxk6EfWiXOxoXvEVpK5Um2EOc9zohZpoe6wYDrulyguxaF7iw22j3VZgXXYDCg1gsMngmtmTfmvj3QWLQ=="}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/readonlykeys?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:38:56 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['239'] + x-ms-correlation-request-id: [b7bfff95-7f1a-43f3-9c08-c221b5f96cdf] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14999'] + x-ms-request-id: [b7bfff95-7f1a-43f3-9c08-c221b5f96cdf] + x-ms-routing-request-id: ['WESTUS2:20170120T233856Z:b7bfff95-7f1a-43f3-9c08-c221b5f96cdf'] + status: {code: 200, message: Ok} +- request: + body: '{"keyKind": "primary"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['22'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [9c295c3e-df69-11e6-8c6e-ecb1d756380e] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/regenerateKey?api-version=2015-04-08 + response: + body: {string: '{"status":"Enqueued","error":{}}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Length: ['32'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:38:57 GMT'] + Location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/regenerateKey/operationResults/44aa0082-8ba8-4d51-ae31-2a802947d174?api-version=2015-04-08'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + x-ms-correlation-request-id: [9a0f4757-a9ec-45a1-bd99-9b26a1cbea09] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-request-id: [44aa0082-8ba8-4d51-ae31-2a802947d174] + x-ms-routing-request-id: ['WESTUS2:20170120T233858Z:9a0f4757-a9ec-45a1-bd99-9b26a1cbea09'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 + msrest_azure/0.4.6 documentdb/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + x-ms-client-request-id: [9c295c3e-df69-11e6-8c6e-ecb1d756380e] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/regenerateKey/operationResults/44aa0082-8ba8-4d51-ae31-2a802947d174?api-version=2015-04-08 + response: + body: {string: '{"primaryMasterKey":"lVtaTfspMCi6OxKnwwqkfQWbPMuk7qNOWhnrdDtVcHHUuF91qorW3xYYufyTS0sgK7QvAydyGSOxQk5yyq2UKA==","secondaryMasterKey":"TBemTAFWd0LRnqZzzjbQtHmwaw0T7fOm0TKQDx4leaFHcqBiOftHRC9wyGUN1XCVDOvoc3W2Ag8itbX5Pzs8JA==","primaryReadonlyMasterKey":"YdVKJP3JJ4fffFTSa9YuFOGEmVx3KblW8MsNDytFWKKurfa8xU1h8XufE6Z4AZcYMu1LVbS2J2n4dCdDbwvkVQ==","secondaryReadonlyMasterKey":"s8HQlRxk6EfWiXOxoXvEVpK5Um2EOc9zohZpoe6wYDrulyguxaF7iw22j3VZgXXYDCg1gsMngmtmTfmvj3QWLQ=="}'} + headers: + Cache-Control: ['no-store, no-cache'] + Content-Location: ['https://management.documents.azure.com:450/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_documentdb_test_accounts_features865411c4/providers/Microsoft.DocumentDB/databaseAccounts/pydocdbtest865411c4/regenerateKey/operationResults/44aa0082-8ba8-4d51-ae31-2a802947d174?api-version=2015-04-08'] + Content-Type: [application/json] + Date: ['Fri, 20 Jan 2017 23:39:28 GMT'] + Pragma: [no-cache] + Server: [Microsoft-HTTPAPI/2.0] + Strict-Transport-Security: [max-age=31536000; includeSubDomains] + Transfer-Encoding: [chunked] + Vary: [Accept-Encoding] + content-length: ['461'] + x-ms-correlation-request-id: [4173bb90-a962-4ace-bf4d-5f4504d75a66] + x-ms-gatewayversion: [version=1.10.121.4] + x-ms-ratelimit-remaining-subscription-reads: ['14996'] + x-ms-request-id: [4173bb90-a962-4ace-bf4d-5f4504d75a66] + x-ms-routing-request-id: ['WESTUS2:20170120T233928Z:4173bb90-a962-4ace-bf4d-5f4504d75a66'] + status: {code: 200, message: Ok} +version: 1 diff --git a/sdk/cosmos/azure-mgmt-documentdb/tests/test_mgmt_documentdb.py b/sdk/cosmos/azure-mgmt-documentdb/tests/test_mgmt_documentdb.py new file mode 100644 index 000000000000..902666a22cf0 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/tests/test_mgmt_documentdb.py @@ -0,0 +1,146 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- +import unittest + +import azure.mgmt.documentdb +from msrestazure.azure_exceptions import CloudError +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer + + +class MgmtDocDBTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtDocDBTest, self).setUp() + self.client = self.create_mgmt_client( + azure.mgmt.documentdb.DocumentDB + ) + + @ResourceGroupPreparer() + def test_accounts_create(self, resource_group, location): + account_name = self.get_resource_name('pydocdbtst') + + self.assertFalse(self.client.database_accounts.check_name_exists(account_name)) + + async_docdb_create = self.client.database_accounts.create_or_update( + resource_group.name, + account_name, + { + 'location': location, + 'locations': [{ + 'location_name': self.region + }] + } + ) + account = async_docdb_create.result() + self.assertIsNotNone(account) + # Rest API issue + # self.assertEqual(account.name, account_name) + + @ResourceGroupPreparer() + def test_accounts_features(self, resource_group, location): + account_name = self.get_resource_name('pydocdbtest') + + if not self.is_playback(): + async_docdb_create = self.client.database_accounts.create_or_update( + resource_group.name, + account_name, + { + 'location': location, + 'locations': [{ + 'location_name': self.region + }] + } + ) + async_docdb_create.wait() + + account = self.client.database_accounts.get( + resource_group.name, + account_name + ) + self.assertEqual(account.name, account_name) + + my_accounts = list(self.client.database_accounts.list_by_resource_group(resource_group.name)) + self.assertEqual(len(my_accounts), 1) + self.assertEqual(my_accounts[0].name, account_name) + + my_accounts = list(self.client.database_accounts.list()) + self.assertTrue(len(my_accounts) >= 1) + self.assertTrue(any(db.name == account_name for db in my_accounts)) + + # I guess we can make this test with no error, need to check with DocDB team + # This is an interesting test anyway, this implies that the serialization works + # and error message is available. Since this method does not return an object + # (i.e. no deserialization to test), this is a complete test. + # We are NOT here to test the RestAPI, but the Swagger file and Python code. + with self.assertRaises(CloudError) as cm: + async_change = self.client.database_accounts.failover_priority_change( + resource_group.name, + account_name, + [{ + 'location_name': self.region, + 'failover_priority': 0 + }] + ) + async_change.wait() + self.assertIn('Failover priorities must be unique', cm.exception.message) + + my_keys = self.client.database_accounts.list_keys( + resource_group.name, + account_name + ) + self.assertIsNotNone(my_keys.primary_master_key) + self.assertIsNotNone(my_keys.secondary_master_key) + self.assertIsNotNone(my_keys.primary_readonly_master_key) + self.assertIsNotNone(my_keys.secondary_readonly_master_key) + + + my_keys = self.client.database_accounts.list_read_only_keys( + resource_group.name, + account_name + ) + self.assertIsNotNone(my_keys.primary_readonly_master_key) + self.assertIsNotNone(my_keys.secondary_readonly_master_key) + + + async_regenerate = self.client.database_accounts.regenerate_key( + resource_group.name, + account_name, + "primary" + ) + async_regenerate.wait() + + @ResourceGroupPreparer() + def test_accounts_delete(self, resource_group, location): + account_name = self.get_resource_name('pydocumentdbtst') + + if not self.is_playback(): + async_docdb_create = self.client.database_accounts.create_or_update( + resource_group.name, + account_name, + { + 'location': location, + 'locations': [{ + 'location_name': self.region + }] + } + ) + async_docdb_create.wait() + + # Current implementation of msrestazure does not support 404 as a end of LRO delete + # https://github.com/Azure/msrestazure-for-python/issues/7 + async_delete = self.client.database_accounts.delete(resource_group.name, account_name) + try: + async_delete.wait() + except CloudError as err: + if err.response.status_code != 404: + raise + + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main()