diff --git a/azure-mgmt-cosmosdb/MANIFEST.in b/azure-mgmt-cosmosdb/MANIFEST.in index 6ceb27f7a96e..e4884efef41b 100644 --- a/azure-mgmt-cosmosdb/MANIFEST.in +++ b/azure-mgmt-cosmosdb/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/mgmt/__init__.py diff --git a/azure-mgmt-cosmosdb/README.rst b/azure-mgmt-cosmosdb/README.rst index 82bd979c7bf5..c693b9a86fbe 100644 --- a/azure-mgmt-cosmosdb/README.rst +++ b/azure-mgmt-cosmosdb/README.rst @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see 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 ===== @@ -47,3 +28,6 @@ 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-cosmosdb%2FREADME.png diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py index 33d6d4fbe653..bdd753aa6762 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py @@ -16,10 +16,27 @@ from .failover_policy_py3 import FailoverPolicy from .virtual_network_rule_py3 import VirtualNetworkRule from .database_account_py3 import DatabaseAccount + from .sql_database_py3 import SqlDatabase + from .indexes_py3 import Indexes + from .included_path_py3 import IncludedPath + from .excluded_path_py3 import ExcludedPath + from .indexing_policy_py3 import IndexingPolicy + from .container_partition_key_py3 import ContainerPartitionKey + from .unique_key_py3 import UniqueKey + from .unique_key_policy_py3 import UniqueKeyPolicy + from .conflict_resolution_policy_py3 import ConflictResolutionPolicy + from .container_py3 import Container + from .mongo_database_py3 import MongoDatabase + from .mongo_collection_py3 import MongoCollection + from .table_py3 import Table + from .cassandra_keyspace_py3 import CassandraKeyspace + from .cassandra_table_py3 import CassandraTable + from .gremlin_database_py3 import GremlinDatabase from .error_response_py3 import ErrorResponse, ErrorResponseException from .failover_policies_py3 import FailoverPolicies from .region_for_online_offline_py3 import RegionForOnlineOffline from .resource_py3 import Resource + from .extended_resource_properties_py3 import ExtendedResourceProperties from .database_account_create_update_parameters_py3 import DatabaseAccountCreateUpdateParameters from .database_account_patch_parameters_py3 import DatabaseAccountPatchParameters from .database_account_list_read_only_keys_result_py3 import DatabaseAccountListReadOnlyKeysResult @@ -27,6 +44,29 @@ from .database_account_connection_string_py3 import DatabaseAccountConnectionString from .database_account_list_connection_strings_result_py3 import DatabaseAccountListConnectionStringsResult from .database_account_regenerate_key_parameters_py3 import DatabaseAccountRegenerateKeyParameters + from .sql_database_resource_py3 import SqlDatabaseResource + from .sql_database_create_update_parameters_py3 import SqlDatabaseCreateUpdateParameters + from .container_resource_py3 import ContainerResource + from .container_create_update_parameters_py3 import ContainerCreateUpdateParameters + from .mongo_database_resource_py3 import MongoDatabaseResource + from .mongo_database_create_update_parameters_py3 import MongoDatabaseCreateUpdateParameters + from .mongo_index_keys_py3 import MongoIndexKeys + from .mongo_index_options_py3 import MongoIndexOptions + from .mongo_index_py3 import MongoIndex + from .mongo_collection_resource_py3 import MongoCollectionResource + from .mongo_collection_create_update_parameters_py3 import MongoCollectionCreateUpdateParameters + from .table_resource_py3 import TableResource + from .table_create_update_parameters_py3 import TableCreateUpdateParameters + from .cassandra_keyspace_resource_py3 import CassandraKeyspaceResource + from .cassandra_keyspace_create_update_parameters_py3 import CassandraKeyspaceCreateUpdateParameters + from .column_py3 import Column + from .cassandra_partition_key_py3 import CassandraPartitionKey + from .cluster_key_py3 import ClusterKey + from .cassandra_schema_py3 import CassandraSchema + from .cassandra_table_resource_py3 import CassandraTableResource + from .cassandra_table_create_update_parameters_py3 import CassandraTableCreateUpdateParameters + from .gremlin_database_resource_py3 import GremlinDatabaseResource + from .gremlin_database_create_update_parameters_py3 import GremlinDatabaseCreateUpdateParameters from .operation_display_py3 import OperationDisplay from .operation_py3 import Operation from .metric_name_py3 import MetricName @@ -46,10 +86,27 @@ from .failover_policy import FailoverPolicy from .virtual_network_rule import VirtualNetworkRule from .database_account import DatabaseAccount + from .sql_database import SqlDatabase + from .indexes import Indexes + from .included_path import IncludedPath + from .excluded_path import ExcludedPath + from .indexing_policy import IndexingPolicy + from .container_partition_key import ContainerPartitionKey + from .unique_key import UniqueKey + from .unique_key_policy import UniqueKeyPolicy + from .conflict_resolution_policy import ConflictResolutionPolicy + from .container import Container + from .mongo_database import MongoDatabase + from .mongo_collection import MongoCollection + from .table import Table + from .cassandra_keyspace import CassandraKeyspace + from .cassandra_table import CassandraTable + from .gremlin_database import GremlinDatabase from .error_response import ErrorResponse, ErrorResponseException from .failover_policies import FailoverPolicies from .region_for_online_offline import RegionForOnlineOffline from .resource import Resource + from .extended_resource_properties import ExtendedResourceProperties 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 @@ -57,6 +114,29 @@ 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 .sql_database_resource import SqlDatabaseResource + from .sql_database_create_update_parameters import SqlDatabaseCreateUpdateParameters + from .container_resource import ContainerResource + from .container_create_update_parameters import ContainerCreateUpdateParameters + from .mongo_database_resource import MongoDatabaseResource + from .mongo_database_create_update_parameters import MongoDatabaseCreateUpdateParameters + from .mongo_index_keys import MongoIndexKeys + from .mongo_index_options import MongoIndexOptions + from .mongo_index import MongoIndex + from .mongo_collection_resource import MongoCollectionResource + from .mongo_collection_create_update_parameters import MongoCollectionCreateUpdateParameters + from .table_resource import TableResource + from .table_create_update_parameters import TableCreateUpdateParameters + from .cassandra_keyspace_resource import CassandraKeyspaceResource + from .cassandra_keyspace_create_update_parameters import CassandraKeyspaceCreateUpdateParameters + from .column import Column + from .cassandra_partition_key import CassandraPartitionKey + from .cluster_key import ClusterKey + from .cassandra_schema import CassandraSchema + from .cassandra_table_resource import CassandraTableResource + from .cassandra_table_create_update_parameters import CassandraTableCreateUpdateParameters + from .gremlin_database_resource import GremlinDatabaseResource + from .gremlin_database_create_update_parameters import GremlinDatabaseCreateUpdateParameters from .operation_display import OperationDisplay from .operation import Operation from .metric_name import MetricName @@ -73,6 +153,14 @@ from .metric_paged import MetricPaged from .usage_paged import UsagePaged from .metric_definition_paged import MetricDefinitionPaged +from .sql_database_paged import SqlDatabasePaged +from .container_paged import ContainerPaged +from .mongo_database_paged import MongoDatabasePaged +from .mongo_collection_paged import MongoCollectionPaged +from .table_paged import TablePaged +from .cassandra_keyspace_paged import CassandraKeyspacePaged +from .cassandra_table_paged import CassandraTablePaged +from .gremlin_database_paged import GremlinDatabasePaged from .operation_paged import OperationPaged from .percentile_metric_paged import PercentileMetricPaged from .partition_metric_paged import PartitionMetricPaged @@ -81,6 +169,11 @@ DatabaseAccountKind, DatabaseAccountOfferType, DefaultConsistencyLevel, + IndexingMode, + DataType, + IndexKind, + PartitionKind, + ConflictResolutionMode, KeyKind, UnitType, PrimaryAggregationType, @@ -93,10 +186,27 @@ 'FailoverPolicy', 'VirtualNetworkRule', 'DatabaseAccount', + 'SqlDatabase', + 'Indexes', + 'IncludedPath', + 'ExcludedPath', + 'IndexingPolicy', + 'ContainerPartitionKey', + 'UniqueKey', + 'UniqueKeyPolicy', + 'ConflictResolutionPolicy', + 'Container', + 'MongoDatabase', + 'MongoCollection', + 'Table', + 'CassandraKeyspace', + 'CassandraTable', + 'GremlinDatabase', 'ErrorResponse', 'ErrorResponseException', 'FailoverPolicies', 'RegionForOnlineOffline', 'Resource', + 'ExtendedResourceProperties', 'DatabaseAccountCreateUpdateParameters', 'DatabaseAccountPatchParameters', 'DatabaseAccountListReadOnlyKeysResult', @@ -104,6 +214,29 @@ 'DatabaseAccountConnectionString', 'DatabaseAccountListConnectionStringsResult', 'DatabaseAccountRegenerateKeyParameters', + 'SqlDatabaseResource', + 'SqlDatabaseCreateUpdateParameters', + 'ContainerResource', + 'ContainerCreateUpdateParameters', + 'MongoDatabaseResource', + 'MongoDatabaseCreateUpdateParameters', + 'MongoIndexKeys', + 'MongoIndexOptions', + 'MongoIndex', + 'MongoCollectionResource', + 'MongoCollectionCreateUpdateParameters', + 'TableResource', + 'TableCreateUpdateParameters', + 'CassandraKeyspaceResource', + 'CassandraKeyspaceCreateUpdateParameters', + 'Column', + 'CassandraPartitionKey', + 'ClusterKey', + 'CassandraSchema', + 'CassandraTableResource', + 'CassandraTableCreateUpdateParameters', + 'GremlinDatabaseResource', + 'GremlinDatabaseCreateUpdateParameters', 'OperationDisplay', 'Operation', 'MetricName', @@ -120,6 +253,14 @@ 'MetricPaged', 'UsagePaged', 'MetricDefinitionPaged', + 'SqlDatabasePaged', + 'ContainerPaged', + 'MongoDatabasePaged', + 'MongoCollectionPaged', + 'TablePaged', + 'CassandraKeyspacePaged', + 'CassandraTablePaged', + 'GremlinDatabasePaged', 'OperationPaged', 'PercentileMetricPaged', 'PartitionMetricPaged', @@ -127,6 +268,11 @@ 'DatabaseAccountKind', 'DatabaseAccountOfferType', 'DefaultConsistencyLevel', + 'IndexingMode', + 'DataType', + 'IndexKind', + 'PartitionKind', + 'ConflictResolutionMode', 'KeyKind', 'UnitType', 'PrimaryAggregationType', diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace.py new file mode 100644 index 000000000000..d3da400811fc --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace.py @@ -0,0 +1,57 @@ +# 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 CassandraKeyspace(Resource): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param cassandra_keyspace_id: Required. Name of the Cosmos DB Cassandra + keyspace + :type cassandra_keyspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_id': {'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}'}, + 'cassandra_keyspace_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspace, self).__init__(**kwargs) + self.cassandra_keyspace_id = kwargs.get('cassandra_keyspace_id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_create_update_parameters.py new file mode 100644 index 000000000000..c9fcce128a5b --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_create_update_parameters.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 CassandraKeyspaceCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_create_update_parameters_py3.py new file mode 100644 index 000000000000..586e0e7bbf7e --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_create_update_parameters_py3.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 CassandraKeyspaceCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra keyspace. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra + keyspace + :type resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraKeyspaceResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(CassandraKeyspaceCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_paged.py new file mode 100644 index 000000000000..83a111e99d31 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_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 CassandraKeyspacePaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraKeyspace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraKeyspace]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraKeyspacePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_py3.py new file mode 100644 index 000000000000..d95b1e23228d --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_py3.py @@ -0,0 +1,57 @@ +# 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_py3 import Resource + + +class CassandraKeyspace(Resource): + """An Azure Cosmos DB Cassandra keyspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param cassandra_keyspace_id: Required. Name of the Cosmos DB Cassandra + keyspace + :type cassandra_keyspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_keyspace_id': {'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}'}, + 'cassandra_keyspace_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, *, cassandra_keyspace_id: str, location: str=None, tags=None, **kwargs) -> None: + super(CassandraKeyspace, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_keyspace_id = cassandra_keyspace_id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_resource.py new file mode 100644 index 000000000000..ab347ea0c075 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_resource.py @@ -0,0 +1,34 @@ +# 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 CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_resource_py3.py new file mode 100644 index 000000000000..85faffac66d0 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_keyspace_resource_py3.py @@ -0,0 +1,34 @@ +# 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 CassandraKeyspaceResource(Model): + """Cosmos DB Cassandra keyspace id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra keyspace + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(CassandraKeyspaceResource, self).__init__(**kwargs) + self.id = id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_partition_key.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_partition_key.py new file mode 100644 index 000000000000..e94e0da9c5b3 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_partition_key.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 CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_partition_key_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_partition_key_py3.py new file mode 100644 index 000000000000..fbca51aeedae --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_partition_key_py3.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 CassandraPartitionKey(Model): + """Cosmos DB Cassandra table partition key. + + :param name: Name of the Cosmos DB Cassandra table partition key + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(CassandraPartitionKey, self).__init__(**kwargs) + self.name = name diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_schema.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_schema.py new file mode 100644 index 000000000000..492f687bc6c1 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_schema.py @@ -0,0 +1,37 @@ +# 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 CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: list[~azure.mgmt.cosmosdb.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: list[~azure.mgmt.cosmosdb.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, **kwargs): + super(CassandraSchema, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + self.partition_keys = kwargs.get('partition_keys', None) + self.cluster_keys = kwargs.get('cluster_keys', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_schema_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_schema_py3.py new file mode 100644 index 000000000000..9bc8522d5ab6 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_schema_py3.py @@ -0,0 +1,37 @@ +# 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 CassandraSchema(Model): + """Cosmos DB Cassandra table schema. + + :param columns: List of Cassandra table columns. + :type columns: list[~azure.mgmt.cosmosdb.models.Column] + :param partition_keys: List of partition key. + :type partition_keys: + list[~azure.mgmt.cosmosdb.models.CassandraPartitionKey] + :param cluster_keys: List of cluster key. + :type cluster_keys: list[~azure.mgmt.cosmosdb.models.ClusterKey] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'partition_keys': {'key': 'partitionKeys', 'type': '[CassandraPartitionKey]'}, + 'cluster_keys': {'key': 'clusterKeys', 'type': '[ClusterKey]'}, + } + + def __init__(self, *, columns=None, partition_keys=None, cluster_keys=None, **kwargs) -> None: + super(CassandraSchema, self).__init__(**kwargs) + self.columns = columns + self.partition_keys = partition_keys + self.cluster_keys = cluster_keys diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table.py new file mode 100644 index 000000000000..0820eff6fcd2 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table.py @@ -0,0 +1,64 @@ +# 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 CassandraTable(Resource): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param cassandra_table_id: Required. Name of the Cosmos DB Cassandra table + :type cassandra_table_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.models.CassandraSchema + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_id': {'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}'}, + 'cassandra_table_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, **kwargs): + super(CassandraTable, self).__init__(**kwargs) + self.cassandra_table_id = kwargs.get('cassandra_table_id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_create_update_parameters.py new file mode 100644 index 000000000000..ecc8079df915 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_create_update_parameters.py @@ -0,0 +1,40 @@ +# 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 CassandraTableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_create_update_parameters_py3.py new file mode 100644 index 000000000000..288474bc3d04 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_create_update_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 CassandraTableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Cassandra table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Cassandra table + :type resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'CassandraTableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(CassandraTableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_paged.py new file mode 100644 index 000000000000..3d88c8ab3c2c --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_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 CassandraTablePaged(Paged): + """ + A paging container for iterating over a list of :class:`CassandraTable ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CassandraTable]'} + } + + def __init__(self, *args, **kwargs): + + super(CassandraTablePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_py3.py new file mode 100644 index 000000000000..278da23841d0 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_py3.py @@ -0,0 +1,64 @@ +# 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_py3 import Resource + + +class CassandraTable(Resource): + """An Azure Cosmos DB Cassandra table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param cassandra_table_id: Required. Name of the Cosmos DB Cassandra table + :type cassandra_table_id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.models.CassandraSchema + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'cassandra_table_id': {'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}'}, + 'cassandra_table_id': {'key': 'properties.id', 'type': 'str'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'schema': {'key': 'properties.schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, *, cassandra_table_id: str, location: str=None, tags=None, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTable, self).__init__(location=location, tags=tags, **kwargs) + self.cassandra_table_id = cassandra_table_id + self.default_ttl = default_ttl + self.schema = schema diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_resource.py new file mode 100644 index 000000000000..dc160654c074 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_resource.py @@ -0,0 +1,42 @@ +# 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 CassandraTableResource(Model): + """Cosmos DB Cassandra table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, **kwargs): + super(CassandraTableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.schema = kwargs.get('schema', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_resource_py3.py new file mode 100644 index 000000000000..3519de867b8a --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cassandra_table_resource_py3.py @@ -0,0 +1,42 @@ +# 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 CassandraTableResource(Model): + """Cosmos DB Cassandra table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Cassandra table + :type id: str + :param default_ttl: Time to live of the Cosmos DB Cassandra table + :type default_ttl: int + :param schema: Schema of the Cosmos DB Cassandra table + :type schema: ~azure.mgmt.cosmosdb.models.CassandraSchema + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'schema': {'key': 'schema', 'type': 'CassandraSchema'}, + } + + def __init__(self, *, id: str, default_ttl: int=None, schema=None, **kwargs) -> None: + super(CassandraTableResource, self).__init__(**kwargs) + self.id = id + self.default_ttl = default_ttl + self.schema = schema diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cluster_key.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cluster_key.py new file mode 100644 index 000000000000..c124e17c01d6 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cluster_key.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 ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ClusterKey, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.order_by = kwargs.get('order_by', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cluster_key_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cluster_key_py3.py new file mode 100644 index 000000000000..95943f87cad8 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cluster_key_py3.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 ClusterKey(Model): + """Cosmos DB Cassandra table cluster key. + + :param name: Name of the Cosmos DB Cassandra table cluster key + :type name: str + :param order_by: Order of the Cosmos DB Cassandra table cluster key, only + support "Asc" and "Desc" + :type order_by: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'order_by': {'key': 'orderBy', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, order_by: str=None, **kwargs) -> None: + super(ClusterKey, self).__init__(**kwargs) + self.name = name + self.order_by = order_by diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/column.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/column.py new file mode 100644 index 000000000000..807481567012 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/column.py @@ -0,0 +1,32 @@ +# 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 Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Column, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/column_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/column_py3.py new file mode 100644 index 000000000000..aff65b552c88 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/column_py3.py @@ -0,0 +1,32 @@ +# 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 Column(Model): + """Cosmos DB Cassandra table column. + + :param name: Name of the Cosmos DB Cassandra table column + :type name: str + :param type: Type of the Cosmos DB Cassandra table column + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + super(Column, self).__init__(**kwargs) + self.name = name + self.type = type diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/conflict_resolution_policy.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/conflict_resolution_policy.py new file mode 100644 index 000000000000..a408a77ad7e0 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/conflict_resolution_policy.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 ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or ~azure.mgmt.cosmosdb.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = kwargs.get('mode', "LastWriterWins") + self.conflict_resolution_path = kwargs.get('conflict_resolution_path', None) + self.conflict_resolution_procedure = kwargs.get('conflict_resolution_procedure', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/conflict_resolution_policy_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/conflict_resolution_policy_py3.py new file mode 100644 index 000000000000..a0012afc1a40 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/conflict_resolution_policy_py3.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 ConflictResolutionPolicy(Model): + """The conflict resolution policy for the container. + + :param mode: Indicates the conflict resolution mode. Possible values + include: 'LastWriterWins', 'Custom'. Default value: "LastWriterWins" . + :type mode: str or ~azure.mgmt.cosmosdb.models.ConflictResolutionMode + :param conflict_resolution_path: The conflict resolution path in the case + of LastWriterWins mode. + :type conflict_resolution_path: str + :param conflict_resolution_procedure: The procedure to resolve conflicts + in the case of custom mode. + :type conflict_resolution_procedure: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'conflict_resolution_path': {'key': 'conflictResolutionPath', 'type': 'str'}, + 'conflict_resolution_procedure': {'key': 'conflictResolutionProcedure', 'type': 'str'}, + } + + def __init__(self, *, mode="LastWriterWins", conflict_resolution_path: str=None, conflict_resolution_procedure: str=None, **kwargs) -> None: + super(ConflictResolutionPolicy, self).__init__(**kwargs) + self.mode = mode + self.conflict_resolution_path = conflict_resolution_path + self.conflict_resolution_procedure = conflict_resolution_procedure diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container.py new file mode 100644 index 000000000000..d6bded1c8439 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container.py @@ -0,0 +1,97 @@ +# 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 Container(Resource): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param container_id: Required. Name of the Cosmos DB container + :type container_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'container_id': {'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}'}, + 'container_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Container, self).__init__(**kwargs) + self.container_id = kwargs.get('container_id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_create_update_parameters.py new file mode 100644 index 000000000000..400afaea7b9b --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_create_update_parameters.py @@ -0,0 +1,40 @@ +# 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 ContainerCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB container. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a container + :type resource: ~azure.mgmt.cosmosdb.models.ContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'ContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ContainerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_create_update_parameters_py3.py new file mode 100644 index 000000000000..4963d3660a36 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_create_update_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 ContainerCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB container. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a container + :type resource: ~azure.mgmt.cosmosdb.models.ContainerResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'ContainerResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(ContainerCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_paged.py new file mode 100644 index 000000000000..fcca0f969704 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_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 ContainerPaged(Paged): + """ + A paging container for iterating over a list of :class:`Container ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Container]'} + } + + def __init__(self, *args, **kwargs): + + super(ContainerPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_partition_key.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_partition_key.py new file mode 100644 index 000000000000..846460f42ba0 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_partition_key.py @@ -0,0 +1,35 @@ +# 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 ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) + self.kind = kwargs.get('kind', "Hash") diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_partition_key_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_partition_key_py3.py new file mode 100644 index 000000000000..08e560d7272a --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_partition_key_py3.py @@ -0,0 +1,35 @@ +# 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 ContainerPartitionKey(Model): + """The configuration of the partition key to be used for partitioning data + into multiple partitions. + + :param paths: List of paths using which data within the container can be + partitioned + :type paths: list[str] + :param kind: Indicates the kind of algorithm used for partitioning. + Possible values include: 'Hash', 'Range'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, paths=None, kind="Hash", **kwargs) -> None: + super(ContainerPartitionKey, self).__init__(**kwargs) + self.paths = paths + self.kind = kind diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_py3.py new file mode 100644 index 000000000000..c9541d82f61d --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_py3.py @@ -0,0 +1,97 @@ +# 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_py3 import Resource + + +class Container(Resource): + """An Azure Cosmos DB container. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param container_id: Required. Name of the Cosmos DB container + :type container_id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'container_id': {'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}'}, + 'container_id': {'key': 'properties.id', 'type': 'str'}, + 'indexing_policy': {'key': 'properties.indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'properties.partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'properties.defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'properties.uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'properties.conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, container_id: str, location: str=None, tags=None, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + super(Container, self).__init__(location=location, tags=tags, **kwargs) + self.container_id = container_id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy + self._rid = _rid + self._ts = _ts + self._etag = _etag diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_resource.py new file mode 100644 index 000000000000..88904f98d1b3 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_resource.py @@ -0,0 +1,61 @@ +# 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 ContainerResource(Model): + """Cosmos DB container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, **kwargs): + super(ContainerResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.indexing_policy = kwargs.get('indexing_policy', None) + self.partition_key = kwargs.get('partition_key', None) + self.default_ttl = kwargs.get('default_ttl', None) + self.unique_key_policy = kwargs.get('unique_key_policy', None) + self.conflict_resolution_policy = kwargs.get('conflict_resolution_policy', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_resource_py3.py new file mode 100644 index 000000000000..7ed8915b6d97 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/container_resource_py3.py @@ -0,0 +1,61 @@ +# 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 ContainerResource(Model): + """Cosmos DB container resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB container + :type id: str + :param indexing_policy: The configuration of the indexing policy. By + default, the indexing is automatic for all document paths within the + container + :type indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :param partition_key: The configuration of the partition key to be used + for partitioning data into multiple partitions + :type partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :param default_ttl: Default time to live + :type default_ttl: int + :param unique_key_policy: The unique key policy configuration for + specifying uniqueness constraints on documents in the collection in the + Azure Cosmos DB service. + :type unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :param conflict_resolution_policy: The conflict resolution policy for the + container. + :type conflict_resolution_policy: + ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'indexing_policy': {'key': 'indexingPolicy', 'type': 'IndexingPolicy'}, + 'partition_key': {'key': 'partitionKey', 'type': 'ContainerPartitionKey'}, + 'default_ttl': {'key': 'defaultTtl', 'type': 'int'}, + 'unique_key_policy': {'key': 'uniqueKeyPolicy', 'type': 'UniqueKeyPolicy'}, + 'conflict_resolution_policy': {'key': 'conflictResolutionPolicy', 'type': 'ConflictResolutionPolicy'}, + } + + def __init__(self, *, id: str, indexing_policy=None, partition_key=None, default_ttl: int=None, unique_key_policy=None, conflict_resolution_policy=None, **kwargs) -> None: + super(ContainerResource, self).__init__(**kwargs) + self.id = id + self.indexing_policy = indexing_policy + self.partition_key = partition_key + self.default_ttl = default_ttl + self.unique_key_policy = unique_key_policy + self.conflict_resolution_policy = conflict_resolution_policy diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cosmos_db_enums.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cosmos_db_enums.py index 73dfa4fad8fa..869a1d07777f 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cosmos_db_enums.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/cosmos_db_enums.py @@ -33,6 +33,42 @@ class DefaultConsistencyLevel(str, Enum): consistent_prefix = "ConsistentPrefix" +class IndexingMode(str, Enum): + + consistent = "Consistent" + lazy = "Lazy" + none = "None" + + +class DataType(str, Enum): + + string = "String" + number = "Number" + point = "Point" + polygon = "Polygon" + line_string = "LineString" + multi_polygon = "MultiPolygon" + + +class IndexKind(str, Enum): + + hash = "Hash" + range = "Range" + spatial = "Spatial" + + +class PartitionKind(str, Enum): + + hash = "Hash" + range = "Range" + + +class ConflictResolutionMode(str, Enum): + + last_writer_wins = "LastWriterWins" + custom = "Custom" + + class KeyKind(str, Enum): primary = "primary" diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account.py index debded86eed7..aa8fc15c837a 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account.py @@ -18,16 +18,14 @@ class DatabaseAccount(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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: Required. The location of the resource group to which the - resource belongs. + :param location: The location of the resource group to which the resource + belongs. :type location: str :param tags: :type tags: dict[str, str] @@ -86,7 +84,6 @@ class DatabaseAccount(Resource): '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}, diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters.py index 9ff548fc3efb..a9fa3fdfab68 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters.py @@ -26,8 +26,8 @@ class DatabaseAccountCreateUpdateParameters(Resource): :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :param location: Required. The location of the resource group to which the - resource belongs. + :param location: The location of the resource group to which the resource + belongs. :type location: str :param tags: :type tags: dict[str, str] @@ -41,7 +41,8 @@ class DatabaseAccountCreateUpdateParameters(Resource): :param locations: Required. An array that contains the georeplication locations enabled for the Cosmos DB account. :type locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar database_account_offer_type: Required. Default value: "Standard" . + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . :vartype database_account_offer_type: str :param ip_range_filter: Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included @@ -71,7 +72,6 @@ class DatabaseAccountCreateUpdateParameters(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, 'locations': {'required': True}, 'database_account_offer_type': {'required': True, 'constant': True}, } diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters_py3.py index 491e8e27b2a8..eb39a8a68d94 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters_py3.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters_py3.py @@ -26,8 +26,8 @@ class DatabaseAccountCreateUpdateParameters(Resource): :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :param location: Required. The location of the resource group to which the - resource belongs. + :param location: The location of the resource group to which the resource + belongs. :type location: str :param tags: :type tags: dict[str, str] @@ -41,7 +41,8 @@ class DatabaseAccountCreateUpdateParameters(Resource): :param locations: Required. An array that contains the georeplication locations enabled for the Cosmos DB account. :type locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar database_account_offer_type: Required. Default value: "Standard" . + :ivar database_account_offer_type: Required. The offer type for the + database. Default value: "Standard" . :vartype database_account_offer_type: str :param ip_range_filter: Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included @@ -71,7 +72,6 @@ class DatabaseAccountCreateUpdateParameters(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, 'locations': {'required': True}, 'database_account_offer_type': {'required': True, 'constant': True}, } @@ -96,7 +96,7 @@ class DatabaseAccountCreateUpdateParameters(Resource): database_account_offer_type = "Standard" - def __init__(self, *, location: str, locations, tags=None, kind="GlobalDocumentDB", consistency_policy=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, **kwargs) -> None: + def __init__(self, *, locations, location: str=None, tags=None, kind="GlobalDocumentDB", consistency_policy=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, **kwargs) -> None: super(DatabaseAccountCreateUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) self.kind = kind self.consistency_policy = consistency_policy diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_py3.py index 98d545f416e0..6f587458187c 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_py3.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_py3.py @@ -18,16 +18,14 @@ class DatabaseAccount(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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: Required. The location of the resource group to which the - resource belongs. + :param location: The location of the resource group to which the resource + belongs. :type location: str :param tags: :type tags: dict[str, str] @@ -86,7 +84,6 @@ class DatabaseAccount(Resource): '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}, @@ -116,7 +113,7 @@ class DatabaseAccount(Resource): 'enable_multiple_write_locations': {'key': 'properties.enableMultipleWriteLocations', 'type': 'bool'}, } - def __init__(self, *, location: str, tags=None, kind="GlobalDocumentDB", provisioning_state: str=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, consistency_policy=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, **kwargs) -> None: + def __init__(self, *, location: str=None, tags=None, kind="GlobalDocumentDB", provisioning_state: str=None, ip_range_filter: str=None, is_virtual_network_filter_enabled: bool=None, enable_automatic_failover: bool=None, consistency_policy=None, capabilities=None, virtual_network_rules=None, enable_multiple_write_locations: bool=None, **kwargs) -> None: super(DatabaseAccount, self).__init__(location=location, tags=tags, **kwargs) self.kind = kind self.provisioning_state = provisioning_state diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/excluded_path.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/excluded_path.py new file mode 100644 index 000000000000..c4564deae35b --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/excluded_path.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 ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExcludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/excluded_path_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/excluded_path_py3.py new file mode 100644 index 000000000000..35b2a7f95ab0 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/excluded_path_py3.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 ExcludedPath(Model): + """ExcludedPath. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__(self, *, path: str=None, **kwargs) -> None: + super(ExcludedPath, self).__init__(**kwargs) + self.path = path diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/extended_resource_properties.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/extended_resource_properties.py new file mode 100644 index 000000000000..bc58c85c6cff --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/extended_resource_properties.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 ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases and + SQL containers. + + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/extended_resource_properties_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/extended_resource_properties_py3.py new file mode 100644 index 000000000000..75f13069490c --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/extended_resource_properties_py3.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 ExtendedResourceProperties(Model): + """The system generated resource properties associated with SQL databases and + SQL containers. + + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _attribute_map = { + '_rid': {'key': '_rid', 'type': 'str'}, + '_ts': {'key': '_ts', 'type': 'object'}, + '_etag': {'key': '_etag', 'type': 'str'}, + } + + def __init__(self, *, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + super(ExtendedResourceProperties, self).__init__(**kwargs) + self._rid = _rid + self._ts = _ts + self._etag = _etag diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database.py new file mode 100644 index 000000000000..907020974c2f --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database.py @@ -0,0 +1,71 @@ +# 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 GremlinDatabase(Resource): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param gremlin_database_id: Required. Name of the Cosmos DB Gremlin + database + :type gremlin_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_id': {'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}'}, + 'gremlin_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabase, self).__init__(**kwargs) + self.gremlin_database_id = kwargs.get('gremlin_database_id', None) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_create_update_parameters.py new file mode 100644 index 000000000000..b2fb872c61a1 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_create_update_parameters.py @@ -0,0 +1,40 @@ +# 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 GremlinDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Gremlin database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_create_update_parameters_py3.py new file mode 100644 index 000000000000..a247b2cd4419 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_create_update_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 GremlinDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Gremlin database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Gremlin database + :type resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'GremlinDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(GremlinDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_paged.py new file mode 100644 index 000000000000..797f7087eb5e --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_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 GremlinDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`GremlinDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GremlinDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(GremlinDatabasePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_py3.py new file mode 100644 index 000000000000..a667c3eb8552 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_py3.py @@ -0,0 +1,71 @@ +# 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_py3 import Resource + + +class GremlinDatabase(Resource): + """An Azure Cosmos DB Gremlin database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param gremlin_database_id: Required. Name of the Cosmos DB Gremlin + database + :type gremlin_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'gremlin_database_id': {'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}'}, + 'gremlin_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + } + + def __init__(self, *, gremlin_database_id: str, location: str=None, tags=None, _rid: str=None, _ts=None, _etag: str=None, **kwargs) -> None: + super(GremlinDatabase, self).__init__(location=location, tags=tags, **kwargs) + self.gremlin_database_id = gremlin_database_id + self._rid = _rid + self._ts = _ts + self._etag = _etag diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_resource.py new file mode 100644 index 000000000000..4f7b1caf1ae2 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_resource.py @@ -0,0 +1,34 @@ +# 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 GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_resource_py3.py new file mode 100644 index 000000000000..c4086334e830 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/gremlin_database_resource_py3.py @@ -0,0 +1,34 @@ +# 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 GremlinDatabaseResource(Model): + """Cosmos DB Gremlin database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Gremlin database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(GremlinDatabaseResource, self).__init__(**kwargs) + self.id = id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/included_path.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/included_path.py new file mode 100644 index 000000000000..3b49279501dd --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/included_path.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 IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: list[~azure.mgmt.cosmosdb.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, **kwargs): + super(IncludedPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.indexes = kwargs.get('indexes', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/included_path_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/included_path_py3.py new file mode 100644 index 000000000000..d16e72ee197f --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/included_path_py3.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 IncludedPath(Model): + """The paths that are included in indexing. + + :param path: The path for which the indexing behavior applies to. Index + paths typically start with root and end with wildcard (/path/*) + :type path: str + :param indexes: List of indexes for this path + :type indexes: list[~azure.mgmt.cosmosdb.models.Indexes] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'indexes': {'key': 'indexes', 'type': '[Indexes]'}, + } + + def __init__(self, *, path: str=None, indexes=None, **kwargs) -> None: + super(IncludedPath, self).__init__(**kwargs) + self.path = path + self.indexes = indexes diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexes.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexes.py new file mode 100644 index 000000000000..94c1007f9a39 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexes.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 Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or ~azure.mgmt.cosmosdb.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Indexes, self).__init__(**kwargs) + self.data_type = kwargs.get('data_type', "String") + self.precision = kwargs.get('precision', None) + self.kind = kwargs.get('kind', "Hash") diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexes_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexes_py3.py new file mode 100644 index 000000000000..436c7f787d07 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexes_py3.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 Indexes(Model): + """The indexes for the path. + + :param data_type: The datatype for which the indexing behavior is applied + to. Possible values include: 'String', 'Number', 'Point', 'Polygon', + 'LineString', 'MultiPolygon'. Default value: "String" . + :type data_type: str or ~azure.mgmt.cosmosdb.models.DataType + :param precision: The precision of the index. -1 is maximum precision. + :type precision: int + :param kind: Indicates the type of index. Possible values include: 'Hash', + 'Range', 'Spatial'. Default value: "Hash" . + :type kind: str or ~azure.mgmt.cosmosdb.models.IndexKind + """ + + _attribute_map = { + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'precision': {'key': 'precision', 'type': 'int'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, data_type="String", precision: int=None, kind="Hash", **kwargs) -> None: + super(Indexes, self).__init__(**kwargs) + self.data_type = data_type + self.precision = precision + self.kind = kind diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexing_policy.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexing_policy.py new file mode 100644 index 000000000000..1f52ca8c31ff --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexing_policy.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 IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, **kwargs): + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = kwargs.get('automatic', None) + self.indexing_mode = kwargs.get('indexing_mode', "Consistent") + self.included_paths = kwargs.get('included_paths', None) + self.excluded_paths = kwargs.get('excluded_paths', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexing_policy_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexing_policy_py3.py new file mode 100644 index 000000000000..eba8cb12589d --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/indexing_policy_py3.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 IndexingPolicy(Model): + """Cosmos DB indexing policy. + + :param automatic: Indicates if the indexing policy is automatic + :type automatic: bool + :param indexing_mode: Indicates the indexing mode. Possible values + include: 'Consistent', 'Lazy', 'None'. Default value: "Consistent" . + :type indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode + :param included_paths: List of paths to include in the indexing + :type included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] + :param excluded_paths: List of paths to exclude from indexing + :type excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] + """ + + _attribute_map = { + 'automatic': {'key': 'automatic', 'type': 'bool'}, + 'indexing_mode': {'key': 'indexingMode', 'type': 'str'}, + 'included_paths': {'key': 'includedPaths', 'type': '[IncludedPath]'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[ExcludedPath]'}, + } + + def __init__(self, *, automatic: bool=None, indexing_mode="Consistent", included_paths=None, excluded_paths=None, **kwargs) -> None: + super(IndexingPolicy, self).__init__(**kwargs) + self.automatic = automatic + self.indexing_mode = indexing_mode + self.included_paths = included_paths + self.excluded_paths = excluded_paths diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection.py new file mode 100644 index 000000000000..31902ac79e4d --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection.py @@ -0,0 +1,66 @@ +# 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 MongoCollection(Resource): + """An Azure Cosmos DB Mongo collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param mongo_collection_id: Required. Name of the Cosmos DB Mongo + collection + :type mongo_collection_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_collection_id': {'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}'}, + 'mongo_collection_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, **kwargs): + super(MongoCollection, self).__init__(**kwargs) + self.mongo_collection_id = kwargs.get('mongo_collection_id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_create_update_parameters.py new file mode 100644 index 000000000000..ad0b2e7ce698 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_create_update_parameters.py @@ -0,0 +1,40 @@ +# 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 MongoCollectionCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Mongo collection. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Mongo collection + :type resource: ~azure.mgmt.cosmosdb.models.MongoCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoCollectionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_create_update_parameters_py3.py new file mode 100644 index 000000000000..d23e99376077 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_create_update_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 MongoCollectionCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Mongo collection. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Mongo collection + :type resource: ~azure.mgmt.cosmosdb.models.MongoCollectionResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoCollectionResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(MongoCollectionCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_paged.py new file mode 100644 index 000000000000..fe8cd02fbc21 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_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 MongoCollectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoCollection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoCollection]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoCollectionPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_py3.py new file mode 100644 index 000000000000..693413775e4a --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_py3.py @@ -0,0 +1,66 @@ +# 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_py3 import Resource + + +class MongoCollection(Resource): + """An Azure Cosmos DB Mongo collection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param mongo_collection_id: Required. Name of the Cosmos DB Mongo + collection + :type mongo_collection_id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_collection_id': {'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}'}, + 'mongo_collection_id': {'key': 'properties.id', 'type': 'str'}, + 'shard_key': {'key': 'properties.shardKey', 'type': '{str}'}, + 'indexes': {'key': 'properties.indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, *, mongo_collection_id: str, location: str=None, tags=None, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoCollection, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_collection_id = mongo_collection_id + self.shard_key = shard_key + self.indexes = indexes diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_resource.py new file mode 100644 index 000000000000..d509d63f185f --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_resource.py @@ -0,0 +1,43 @@ +# 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 MongoCollectionResource(Model): + """Cosmos DB Mongo collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Mongo collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, **kwargs): + super(MongoCollectionResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.shard_key = kwargs.get('shard_key', None) + self.indexes = kwargs.get('indexes', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_resource_py3.py new file mode 100644 index 000000000000..75e3d9a4c9a3 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_collection_resource_py3.py @@ -0,0 +1,43 @@ +# 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 MongoCollectionResource(Model): + """Cosmos DB Mongo collection resource object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Mongo collection + :type id: str + :param shard_key: A key-value pair of shard keys to be applied for the + request. + :type shard_key: dict[str, str] + :param indexes: List of index keys + :type indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'shard_key': {'key': 'shardKey', 'type': '{str}'}, + 'indexes': {'key': 'indexes', 'type': '[MongoIndex]'}, + } + + def __init__(self, *, id: str, shard_key=None, indexes=None, **kwargs) -> None: + super(MongoCollectionResource, self).__init__(**kwargs) + self.id = id + self.shard_key = shard_key + self.indexes = indexes diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database.py new file mode 100644 index 000000000000..ab4f963fe49a --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database.py @@ -0,0 +1,56 @@ +# 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 MongoDatabase(Resource): + """An Azure Cosmos DB Mongo database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param mongo_database_id: Required. Name of the Cosmos DB Mongo database + :type mongo_database_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_database_id': {'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}'}, + 'mongo_database_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDatabase, self).__init__(**kwargs) + self.mongo_database_id = kwargs.get('mongo_database_id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_create_update_parameters.py new file mode 100644 index 000000000000..2b59ccf463c6 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_create_update_parameters.py @@ -0,0 +1,40 @@ +# 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 MongoDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Mongo database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Mongo database + :type resource: ~azure.mgmt.cosmosdb.models.MongoDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MongoDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_create_update_parameters_py3.py new file mode 100644 index 000000000000..2d5e4c102d09 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_create_update_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 MongoDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Mongo database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Mongo database + :type resource: ~azure.mgmt.cosmosdb.models.MongoDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'MongoDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(MongoDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_paged.py new file mode 100644 index 000000000000..55908b551f69 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_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 MongoDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`MongoDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MongoDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(MongoDatabasePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_py3.py new file mode 100644 index 000000000000..28b01e633c1f --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_py3.py @@ -0,0 +1,56 @@ +# 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_py3 import Resource + + +class MongoDatabase(Resource): + """An Azure Cosmos DB Mongo database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param mongo_database_id: Required. Name of the Cosmos DB Mongo database + :type mongo_database_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'mongo_database_id': {'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}'}, + 'mongo_database_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, *, mongo_database_id: str, location: str=None, tags=None, **kwargs) -> None: + super(MongoDatabase, self).__init__(location=location, tags=tags, **kwargs) + self.mongo_database_id = mongo_database_id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_resource.py new file mode 100644 index 000000000000..dd1e6c330a45 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_resource.py @@ -0,0 +1,34 @@ +# 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 MongoDatabaseResource(Model): + """Cosmos DB Mongo database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Mongo database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MongoDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_resource_py3.py new file mode 100644 index 000000000000..a36d3febd64b --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_database_resource_py3.py @@ -0,0 +1,34 @@ +# 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 MongoDatabaseResource(Model): + """Cosmos DB Mongo database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB Mongo database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(MongoDatabaseResource, self).__init__(**kwargs) + self.id = id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index.py new file mode 100644 index 000000000000..b37af9ccd1d9 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index.py @@ -0,0 +1,32 @@ +# 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 MongoIndex(Model): + """Cosmos DB Mongo collection index key. + + :param key: Cosmos DB Mongo collection index keys + :type key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys + :param options: Cosmos DB Mongo collection index key options + :type options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, **kwargs): + super(MongoIndex, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_keys.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_keys.py new file mode 100644 index 000000000000..5c81abb5b8a2 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_keys.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 MongoIndexKeys(Model): + """Cosmos DB Mongo collection resource object. + + :param keys: List of keys for each Mongo collection in the Azure Cosmos DB + service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_keys_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_keys_py3.py new file mode 100644 index 000000000000..7696248e3ab2 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_keys_py3.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 MongoIndexKeys(Model): + """Cosmos DB Mongo collection resource object. + + :param keys: List of keys for each Mongo collection in the Azure Cosmos DB + service + :type keys: list[str] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + } + + def __init__(self, *, keys=None, **kwargs) -> None: + super(MongoIndexKeys, self).__init__(**kwargs) + self.keys = keys diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_options.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_options.py new file mode 100644 index 000000000000..f32fbd8a7577 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_options.py @@ -0,0 +1,32 @@ +# 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 MongoIndexOptions(Model): + """Cosmos DB Mongo collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = kwargs.get('expire_after_seconds', None) + self.unique = kwargs.get('unique', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_options_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_options_py3.py new file mode 100644 index 000000000000..e45318fbde73 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_options_py3.py @@ -0,0 +1,32 @@ +# 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 MongoIndexOptions(Model): + """Cosmos DB Mongo collection index options. + + :param expire_after_seconds: Expire after seconds + :type expire_after_seconds: int + :param unique: Is unique or not + :type unique: bool + """ + + _attribute_map = { + 'expire_after_seconds': {'key': 'expireAfterSeconds', 'type': 'int'}, + 'unique': {'key': 'unique', 'type': 'bool'}, + } + + def __init__(self, *, expire_after_seconds: int=None, unique: bool=None, **kwargs) -> None: + super(MongoIndexOptions, self).__init__(**kwargs) + self.expire_after_seconds = expire_after_seconds + self.unique = unique diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_py3.py new file mode 100644 index 000000000000..357ec3b3d5d3 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/mongo_index_py3.py @@ -0,0 +1,32 @@ +# 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 MongoIndex(Model): + """Cosmos DB Mongo collection index key. + + :param key: Cosmos DB Mongo collection index keys + :type key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys + :param options: Cosmos DB Mongo collection index key options + :type options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'MongoIndexKeys'}, + 'options': {'key': 'options', 'type': 'MongoIndexOptions'}, + } + + def __init__(self, *, key=None, options=None, **kwargs) -> None: + super(MongoIndex, self).__init__(**kwargs) + self.key = key + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource.py index 2301bf320b7a..2974ab9647e4 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource.py @@ -13,21 +13,19 @@ class Resource(Model): - """A database account resource. + """The core properties of ARM resources. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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: Required. The location of the resource group to which the - resource belongs. + :param location: The location of the resource group to which the resource + belongs. :type location: str :param tags: :type tags: dict[str, str] @@ -37,7 +35,6 @@ class Resource(Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, } _attribute_map = { diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource_py3.py index 58f36e19ff13..9b7141be5779 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource_py3.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/resource_py3.py @@ -13,21 +13,19 @@ class Resource(Model): - """A database account resource. + """The core properties of ARM resources. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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: Required. The location of the resource group to which the - resource belongs. + :param location: The location of the resource group to which the resource + belongs. :type location: str :param tags: :type tags: dict[str, str] @@ -37,7 +35,6 @@ class Resource(Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, } _attribute_map = { @@ -48,7 +45,7 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: super(Resource, self).__init__(**kwargs) self.id = None self.name = None diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database.py new file mode 100644 index 000000000000..bcd3b6845e6f --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database.py @@ -0,0 +1,80 @@ +# 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 SqlDatabase(Resource): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param sql_database_id: Required. Name of the Cosmos DB SQL database + :type sql_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_id': {'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}'}, + 'sql_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabase, self).__init__(**kwargs) + self.sql_database_id = kwargs.get('sql_database_id', None) + self._rid = kwargs.get('_rid', None) + self._ts = kwargs.get('_ts', None) + self._etag = kwargs.get('_etag', None) + self._colls = kwargs.get('_colls', None) + self._users = kwargs.get('_users', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_create_update_parameters.py new file mode 100644 index 000000000000..26325eb6b0d4 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_create_update_parameters.py @@ -0,0 +1,40 @@ +# 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 SqlDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB SQL database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a SQL database + :type resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_create_update_parameters_py3.py new file mode 100644 index 000000000000..99d5c43f00f5 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_create_update_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 SqlDatabaseCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB SQL database. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a SQL database + :type resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'SqlDatabaseResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(SqlDatabaseCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_paged.py new file mode 100644 index 000000000000..c455b7e6b0c8 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_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 SqlDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`SqlDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SqlDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(SqlDatabasePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_py3.py new file mode 100644 index 000000000000..7fd40eadd9c1 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_py3.py @@ -0,0 +1,80 @@ +# 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_py3 import Resource + + +class SqlDatabase(Resource): + """An Azure Cosmos DB SQL database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param sql_database_id: Required. Name of the Cosmos DB SQL database + :type sql_database_id: str + :param _rid: A system generated property. A unique identifier. + :type _rid: str + :param _ts: A system generated property that denotes the last updated + timestamp of the resource. + :type _ts: object + :param _etag: A system generated property representing the resource etag + required for optimistic concurrency control. + :type _etag: str + :param _colls: A system generated property that specified the addressable + path of the collections resource. + :type _colls: str + :param _users: A system generated property that specifies the addressable + path of the users resource. + :type _users: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sql_database_id': {'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}'}, + 'sql_database_id': {'key': 'properties.id', 'type': 'str'}, + '_rid': {'key': 'properties._rid', 'type': 'str'}, + '_ts': {'key': 'properties._ts', 'type': 'object'}, + '_etag': {'key': 'properties._etag', 'type': 'str'}, + '_colls': {'key': 'properties._colls', 'type': 'str'}, + '_users': {'key': 'properties._users', 'type': 'str'}, + } + + def __init__(self, *, sql_database_id: str, location: str=None, tags=None, _rid: str=None, _ts=None, _etag: str=None, _colls: str=None, _users: str=None, **kwargs) -> None: + super(SqlDatabase, self).__init__(location=location, tags=tags, **kwargs) + self.sql_database_id = sql_database_id + self._rid = _rid + self._ts = _ts + self._etag = _etag + self._colls = _colls + self._users = _users diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_resource.py new file mode 100644 index 000000000000..aa127d833169 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_resource.py @@ -0,0 +1,34 @@ +# 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 SqlDatabaseResource(Model): + """Cosmos DB SQL database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_resource_py3.py new file mode 100644 index 000000000000..5eee3add3acf --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/sql_database_resource_py3.py @@ -0,0 +1,34 @@ +# 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 SqlDatabaseResource(Model): + """Cosmos DB SQL database id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB SQL database + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(SqlDatabaseResource, self).__init__(**kwargs) + self.id = id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table.py new file mode 100644 index 000000000000..9e9471cdacfc --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table.py @@ -0,0 +1,56 @@ +# 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 Table(Resource): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param table_id: Required. Name of the Cosmos DB table + :type table_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_id': {'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}'}, + 'table_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Table, self).__init__(**kwargs) + self.table_id = kwargs.get('table_id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_create_update_parameters.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_create_update_parameters.py new file mode 100644 index 000000000000..d137cbd174ab --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_create_update_parameters.py @@ -0,0 +1,40 @@ +# 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 TableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + self.options = kwargs.get('options', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_create_update_parameters_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_create_update_parameters_py3.py new file mode 100644 index 000000000000..8df45b13e2ac --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_create_update_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 TableCreateUpdateParameters(Model): + """Parameters to create and update Cosmos DB Table. + + All required parameters must be populated in order to send to Azure. + + :param resource: Required. The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.models.TableResource + :param options: Required. A key-value pair of options to be applied for + the request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + """ + + _validation = { + 'resource': {'required': True}, + 'options': {'required': True}, + } + + _attribute_map = { + 'resource': {'key': 'properties.resource', 'type': 'TableResource'}, + 'options': {'key': 'properties.options', 'type': '{str}'}, + } + + def __init__(self, *, resource, options, **kwargs) -> None: + super(TableCreateUpdateParameters, self).__init__(**kwargs) + self.resource = resource + self.options = options diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_paged.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_paged.py new file mode 100644 index 000000000000..3594d381ac93 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_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 TablePaged(Paged): + """ + A paging container for iterating over a list of :class:`Table ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Table]'} + } + + def __init__(self, *args, **kwargs): + + super(TablePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_py3.py new file mode 100644 index 000000000000..a715fae85b02 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_py3.py @@ -0,0 +1,56 @@ +# 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_py3 import Resource + + +class Table(Resource): + """An Azure Cosmos DB Table. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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[str, str] + :param table_id: Required. Name of the Cosmos DB table + :type table_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'table_id': {'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}'}, + 'table_id': {'key': 'properties.id', 'type': 'str'}, + } + + def __init__(self, *, table_id: str, location: str=None, tags=None, **kwargs) -> None: + super(Table, self).__init__(location=location, tags=tags, **kwargs) + self.table_id = table_id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_resource.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_resource.py new file mode 100644 index 000000000000..5f61db6973aa --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_resource.py @@ -0,0 +1,34 @@ +# 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 TableResource(Model): + """Cosmos DB table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TableResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_resource_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_resource_py3.py new file mode 100644 index 000000000000..d39d83656ec2 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/table_resource_py3.py @@ -0,0 +1,34 @@ +# 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 TableResource(Model): + """Cosmos DB table id object. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Name of the Cosmos DB table + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(TableResource, self).__init__(**kwargs) + self.id = id diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key.py new file mode 100644 index 000000000000..4208cbc7965e --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key.py @@ -0,0 +1,30 @@ +# 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 UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UniqueKey, self).__init__(**kwargs) + self.paths = kwargs.get('paths', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_policy.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_policy.py new file mode 100644 index 000000000000..40b22c3f41e5 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_policy.py @@ -0,0 +1,30 @@ +# 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 UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: list[~azure.mgmt.cosmosdb.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, **kwargs): + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = kwargs.get('unique_keys', None) diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_policy_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_policy_py3.py new file mode 100644 index 000000000000..d5d8b90941b0 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_policy_py3.py @@ -0,0 +1,30 @@ +# 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 UniqueKeyPolicy(Model): + """The unique key policy configuration for specifying uniqueness constraints + on documents in the collection in the Azure Cosmos DB service. + + :param unique_keys: List of unique keys on that enforces uniqueness + constraint on documents in the collection in the Azure Cosmos DB service. + :type unique_keys: list[~azure.mgmt.cosmosdb.models.UniqueKey] + """ + + _attribute_map = { + 'unique_keys': {'key': 'uniqueKeys', 'type': '[UniqueKey]'}, + } + + def __init__(self, *, unique_keys=None, **kwargs) -> None: + super(UniqueKeyPolicy, self).__init__(**kwargs) + self.unique_keys = unique_keys diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_py3.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_py3.py new file mode 100644 index 000000000000..d64e814da1f8 --- /dev/null +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/unique_key_py3.py @@ -0,0 +1,30 @@ +# 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 UniqueKey(Model): + """The unique key on that enforces uniqueness constraint on documents in the + collection in the Azure Cosmos DB service. + + :param paths: List of paths must be unique for each document in the Azure + Cosmos DB service + :type paths: list[str] + """ + + _attribute_map = { + 'paths': {'key': 'paths', 'type': '[str]'}, + } + + def __init__(self, *, paths=None, **kwargs) -> None: + super(UniqueKey, self).__init__(**kwargs) + self.paths = paths diff --git a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/database_accounts_operations.py b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/database_accounts_operations.py index d335ca059a16..0e9d33bf14a5 100644 --- a/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/database_accounts_operations.py +++ b/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/database_accounts_operations.py @@ -1417,3 +1417,3028 @@ def internal_paging(next_link=None, raw=False): return deserialized list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions'} + + def list_sql_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the SQL databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB 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`. + :return: An iterator like instance of SqlDatabase + :rtype: + ~azure.mgmt.cosmosdb.models.SqlDatabasePaged[~azure.mgmt.cosmosdb.models.SqlDatabase] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_sql_databases.metadata['url'] + 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=r'^[-\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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.SqlDatabasePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SqlDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_sql_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases'} + + def get_sql_database( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Gets the SQL databases under an existing Azure Cosmos DB database + account with the provided id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: 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`. + :return: SqlDatabase or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('SqlDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseRid}'} + + + def _create_update_sql_database_initial( + self, resource_group_name, account_name, database_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_sql_database_parameters = models.SqlDatabaseCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_sql_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_sql_database_parameters, 'SqlDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('SqlDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_database( + self, resource_group_name, account_name, database_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param resource: The standard JSON format of a SQL database + :type resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SqlDatabase or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.SqlDatabase] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.SqlDatabase]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SqlDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseRid}'} + + + def _delete_sql_database_initial( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_sql_database( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseRid}'} + + def list_sql_containers( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Lists the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: 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`. + :return: An iterator like instance of Container + :rtype: + ~azure.mgmt.cosmosdb.models.ContainerPaged[~azure.mgmt.cosmosdb.models.Container] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_sql_containers.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.ContainerPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ContainerPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_sql_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseRid}/containers'} + + def get_sql_container( + self, resource_group_name, account_name, database_rid, container_rid, custom_headers=None, raw=False, **operation_config): + """Gets the SQL container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param container_rid: Cosmos DB container rid. + :type container_rid: 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`. + :return: Container or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.Container or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_sql_container.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'containerRid': self._serialize.url("container_rid", container_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('Container', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseRid}/containers/{containerRid}'} + + + def _create_update_sql_container_initial( + self, resource_group_name, account_name, database_rid, container_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_sql_container_parameters = models.ContainerCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_sql_container.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'containerRid': self._serialize.url("container_rid", container_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_sql_container_parameters, 'ContainerCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('Container', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_sql_container( + self, resource_group_name, account_name, database_rid, container_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param container_rid: Cosmos DB container rid. + :type container_rid: str + :param resource: The standard JSON format of a container + :type resource: ~azure.mgmt.cosmosdb.models.ContainerResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Container or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.Container] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.Container]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + container_rid=container_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Container', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseRid}/containers/{containerRid}'} + + + def _delete_sql_container_initial( + self, resource_group_name, account_name, database_rid, container_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_sql_container.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'containerRid': self._serialize.url("container_rid", container_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_sql_container( + self, resource_group_name, account_name, database_rid, container_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB SQL container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param container_rid: Cosmos DB container rid. + :type container_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_sql_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + container_rid=container_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_sql_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseRid}/containers/{containerRid}'} + + def list_mongo_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Mongo databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB 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`. + :return: An iterator like instance of MongoDatabase + :rtype: + ~azure.mgmt.cosmosdb.models.MongoDatabasePaged[~azure.mgmt.cosmosdb.models.MongoDatabase] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_mongo_databases.metadata['url'] + 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=r'^[-\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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.MongoDatabasePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.MongoDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_mongo_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases'} + + def get_mongo_database( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Gets the Mongo databases under an existing Azure Cosmos DB database + account with the provided id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: 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`. + :return: MongoDatabase or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.MongoDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('MongoDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases/{databaseRid}'} + + + def _create_update_mongo_database_initial( + self, resource_group_name, account_name, database_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_mongo_database_parameters = models.MongoDatabaseCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_mongo_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_mongo_database_parameters, 'MongoDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('MongoDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_database( + self, resource_group_name, account_name, database_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or updates Azure Cosmos DB Mongo database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param resource: The standard JSON format of a Mongo database + :type resource: ~azure.mgmt.cosmosdb.models.MongoDatabaseResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns MongoDatabase or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.MongoDatabase] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.MongoDatabase]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases/{databaseRid}'} + + + def _delete_mongo_database_initial( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_mongo_database( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Mongo database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases/{databaseRid}'} + + def list_mongo_collections( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Lists the Mongo collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: 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`. + :return: An iterator like instance of MongoCollection + :rtype: + ~azure.mgmt.cosmosdb.models.MongoCollectionPaged[~azure.mgmt.cosmosdb.models.MongoCollection] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_mongo_collections.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.MongoCollectionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.MongoCollectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_mongo_collections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases/{databaseRid}/collections'} + + def get_mongo_collection( + self, resource_group_name, account_name, database_rid, collection_rid, custom_headers=None, raw=False, **operation_config): + """Gets the Mongo collection under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: 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`. + :return: MongoCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.MongoCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_mongo_collection.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('MongoCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_mongo_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases/{databaseRid}/collections/{collectionRid}'} + + + def _create_update_mongo_collection_initial( + self, resource_group_name, account_name, database_rid, collection_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_mongo_collection_parameters = models.MongoCollectionCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_mongo_collection.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_mongo_collection_parameters, 'MongoCollectionCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('MongoCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_mongo_collection( + self, resource_group_name, account_name, database_rid, collection_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Mongo Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param resource: The standard JSON format of a Mongo collection + :type resource: ~azure.mgmt.cosmosdb.models.MongoCollectionResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns MongoCollection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.MongoCollection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.MongoCollection]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_mongo_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('MongoCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_mongo_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases/{databaseRid}/collections/{collectionRid}'} + + + def _delete_mongo_collection_initial( + self, resource_group_name, account_name, database_rid, collection_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_mongo_collection.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'collectionRid': self._serialize.url("collection_rid", collection_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_mongo_collection( + self, resource_group_name, account_name, database_rid, collection_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Mongo Collection. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. + :type collection_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_mongo_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_mongo_collection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/mongo/databases/{databaseRid}/collections/{collectionRid}'} + + def list_tables( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Tables under an existing Azure Cosmos DB database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB 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`. + :return: An iterator like instance of Table + :rtype: + ~azure.mgmt.cosmosdb.models.TablePaged[~azure.mgmt.cosmosdb.models.Table] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_tables.metadata['url'] + 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=r'^[-\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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.TablePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.TablePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables'} + + def get_table( + self, resource_group_name, account_name, table_rid, custom_headers=None, raw=False, **operation_config): + """Gets the Tables under an existing Azure Cosmos DB database account with + the provided id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_rid: Cosmos DB table rid. + :type table_rid: 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`. + :return: Table or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.Table or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_table.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'tableRid': self._serialize.url("table_rid", table_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableRid}'} + + + def _create_update_table_initial( + self, resource_group_name, account_name, table_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_table_parameters = models.TableCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_table.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'tableRid': self._serialize.url("table_rid", table_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_table_parameters, 'TableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_table( + self, resource_group_name, account_name, table_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_rid: Cosmos DB table rid. + :type table_rid: str + :param resource: The standard JSON format of a Table + :type resource: ~azure.mgmt.cosmosdb.models.TableResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Table or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.Table] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.Table]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_rid=table_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableRid}'} + + + def _delete_table_initial( + self, resource_group_name, account_name, table_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_table.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'tableRid': self._serialize.url("table_rid", table_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_table( + self, resource_group_name, account_name, table_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param table_rid: Cosmos DB table rid. + :type table_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_rid=table_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/table/tables/{tableRid}'} + + def list_cassandra_keyspaces( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra keyspaces under an existing Azure Cosmos DB + database account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB 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`. + :return: An iterator like instance of CassandraKeyspace + :rtype: + ~azure.mgmt.cosmosdb.models.CassandraKeyspacePaged[~azure.mgmt.cosmosdb.models.CassandraKeyspace] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_cassandra_keyspaces.metadata['url'] + 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=r'^[-\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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.CassandraKeyspacePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.CassandraKeyspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_cassandra_keyspaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces'} + + def get_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_rid, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database + account with the provided id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_rid: Cosmos DB keyspace rid. + :type keyspace_rid: 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`. + :return: CassandraKeyspace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspace or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_keyspace.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'keyspaceRid': self._serialize.url("keyspace_rid", keyspace_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('CassandraKeyspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceRid}'} + + + def _create_update_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_cassandra_keyspace_parameters = models.CassandraKeyspaceCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_cassandra_keyspace.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'keyspaceRid': self._serialize.url("keyspace_rid", keyspace_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_cassandra_keyspace_parameters, 'CassandraKeyspaceCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('CassandraKeyspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_rid: Cosmos DB keyspace rid. + :type keyspace_rid: str + :param resource: The standard JSON format of a Cassandra keyspace + :type resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns CassandraKeyspace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.CassandraKeyspace]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_rid=keyspace_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraKeyspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceRid}'} + + + def _delete_cassandra_keyspace_initial( + self, resource_group_name, account_name, keyspace_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_keyspace.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'keyspaceRid': self._serialize.url("keyspace_rid", keyspace_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_cassandra_keyspace( + self, resource_group_name, account_name, keyspace_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra keyspace. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_rid: Cosmos DB keyspace rid. + :type keyspace_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_keyspace_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_rid=keyspace_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_keyspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceRid}'} + + def list_cassandra_tables( + self, resource_group_name, account_name, keyspace_rid, custom_headers=None, raw=False, **operation_config): + """Lists the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_rid: Cosmos DB keyspace rid. + :type keyspace_rid: 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`. + :return: An iterator like instance of CassandraTable + :rtype: + ~azure.mgmt.cosmosdb.models.CassandraTablePaged[~azure.mgmt.cosmosdb.models.CassandraTable] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_cassandra_tables.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'keyspaceRid': self._serialize.url("keyspace_rid", keyspace_rid, '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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.CassandraTablePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.CassandraTablePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_cassandra_tables.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceRid}/tables'} + + def get_cassandra_table( + self, resource_group_name, account_name, keyspace_rid, table_rid, custom_headers=None, raw=False, **operation_config): + """Gets the Cassandra table under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_rid: Cosmos DB keyspace rid. + :type keyspace_rid: str + :param table_rid: Cosmos DB table rid. + :type table_rid: 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`. + :return: CassandraTable or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.CassandraTable or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_cassandra_table.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'keyspaceRid': self._serialize.url("keyspace_rid", keyspace_rid, 'str'), + 'tableRid': self._serialize.url("table_rid", table_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('CassandraTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceRid}/tables/{tableRid}'} + + + def _create_update_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_rid, table_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_cassandra_table_parameters = models.CassandraTableCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_cassandra_table.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'keyspaceRid': self._serialize.url("keyspace_rid", keyspace_rid, 'str'), + 'tableRid': self._serialize.url("table_rid", table_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_cassandra_table_parameters, 'CassandraTableCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('CassandraTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_cassandra_table( + self, resource_group_name, account_name, keyspace_rid, table_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Cassandra Table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_rid: Cosmos DB keyspace rid. + :type keyspace_rid: str + :param table_rid: Cosmos DB table rid. + :type table_rid: str + :param resource: The standard JSON format of a Cassandra table + :type resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns CassandraTable or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.CassandraTable] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.CassandraTable]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_rid=keyspace_rid, + table_rid=table_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CassandraTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceRid}/tables/{tableRid}'} + + + def _delete_cassandra_table_initial( + self, resource_group_name, account_name, keyspace_rid, table_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_cassandra_table.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'keyspaceRid': self._serialize.url("keyspace_rid", keyspace_rid, 'str'), + 'tableRid': self._serialize.url("table_rid", table_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_cassandra_table( + self, resource_group_name, account_name, keyspace_rid, table_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Cassandra table. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param keyspace_rid: Cosmos DB keyspace rid. + :type keyspace_rid: str + :param table_rid: Cosmos DB table rid. + :type table_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_cassandra_table_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_rid=keyspace_rid, + table_rid=table_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_cassandra_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/cassandra/keyspaces/{keyspaceRid}/tables/{tableRid}'} + + def list_gremlin_databases( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin databases under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB 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`. + :return: An iterator like instance of GremlinDatabase + :rtype: + ~azure.mgmt.cosmosdb.models.GremlinDatabasePaged[~azure.mgmt.cosmosdb.models.GremlinDatabase] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_gremlin_databases.metadata['url'] + 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=r'^[-\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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.GremlinDatabasePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.GremlinDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_gremlin_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases'} + + def get_gremlin_database( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin databases under an existing Azure Cosmos DB database + account with the provided id. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: 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`. + :return: GremlinDatabase or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('GremlinDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseRid}'} + + + def _create_update_gremlin_database_initial( + self, resource_group_name, account_name, database_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_gremlin_database_parameters = models.GremlinDatabaseCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_gremlin_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_gremlin_database_parameters, 'GremlinDatabaseCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('GremlinDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_database( + self, resource_group_name, account_name, database_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param resource: The standard JSON format of a Gremlin database + :type resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GremlinDatabase or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.GremlinDatabase] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.GremlinDatabase]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GremlinDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseRid}'} + + + def _delete_gremlin_database_initial( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_database.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_gremlin_database( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin database. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseRid}'} + + def list_gremlin_containers( + self, resource_group_name, account_name, database_rid, custom_headers=None, raw=False, **operation_config): + """Lists the Gremlin container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: 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`. + :return: An iterator like instance of Container + :rtype: + ~azure.mgmt.cosmosdb.models.ContainerPaged[~azure.mgmt.cosmosdb.models.Container] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_gremlin_containers.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, '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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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.ContainerPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ContainerPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_gremlin_containers.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseRid}/containers'} + + def get_gremlin_container( + self, resource_group_name, account_name, database_rid, container_rid, custom_headers=None, raw=False, **operation_config): + """Gets the Gremlin container under an existing Azure Cosmos DB database + account. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param container_rid: Cosmos DB container rid. + :type container_rid: 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`. + :return: Container or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.cosmosdb.models.Container or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_gremlin_container.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'containerRid': self._serialize.url("container_rid", container_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **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('Container', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gremlin_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseRid}/containers/{containerRid}'} + + + def _create_update_gremlin_container_initial( + self, resource_group_name, account_name, database_rid, container_rid, resource, options, custom_headers=None, raw=False, **operation_config): + create_update_gremlin_container_parameters = models.ContainerCreateUpdateParameters(resource=resource, options=options) + + # Construct URL + url = self.create_update_gremlin_container.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'containerRid': self._serialize.url("container_rid", container_rid, '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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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_gremlin_container_parameters, 'ContainerCreateUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('Container', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_update_gremlin_container( + self, resource_group_name, account_name, database_rid, container_rid, resource, options, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an Azure Cosmos DB Gremlin container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param container_rid: Cosmos DB container rid. + :type container_rid: str + :param resource: The standard JSON format of a container + :type resource: ~azure.mgmt.cosmosdb.models.ContainerResource + :param options: A key-value pair of options to be applied for the + request. This corresponds to the headers sent with the request. + :type options: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Container or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cosmosdb.models.Container] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cosmosdb.models.Container]] + :raises: :class:`CloudError` + """ + raw_result = self._create_update_gremlin_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + container_rid=container_rid, + resource=resource, + options=options, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Container', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_update_gremlin_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseRid}/containers/{containerRid}'} + + + def _delete_gremlin_container_initial( + self, resource_group_name, account_name, database_rid, container_rid, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_gremlin_container.metadata['url'] + 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=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=50, min_length=3), + 'databaseRid': self._serialize.url("database_rid", database_rid, 'str'), + 'containerRid': self._serialize.url("container_rid", container_rid, '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') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + 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 + + def delete_gremlin_container( + self, resource_group_name, account_name, database_rid, container_rid, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing Azure Cosmos DB Gremlin container. + + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. + :type account_name: str + :param database_rid: Cosmos DB database rid. + :type database_rid: str + :param container_rid: Cosmos DB container rid. + :type container_rid: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_gremlin_container_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + container_rid=container_rid, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_gremlin_container.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/gremlin/databases/{databaseRid}/containers/{containerRid}'} diff --git a/azure-mgmt-cosmosdb/setup.py b/azure-mgmt-cosmosdb/setup.py index 4bec3ee72d0e..3a758d591ac2 100644 --- a/azure-mgmt-cosmosdb/setup.py +++ b/azure-mgmt-cosmosdb/setup.py @@ -53,6 +53,7 @@ version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', license='MIT License', author='Microsoft Corporation', author_email='azpysdkhelp@microsoft.com',