Skip to content

Commit

Permalink
Merge pull request Azure#903 from lmazuel/docdb_mgmt
Browse files Browse the repository at this point in the history
azure-mgmt-documentdb
  • Loading branch information
lmazuel authored Jan 31, 2017
2 parents ace8c11 + 36ea13e commit 2a93c1a
Show file tree
Hide file tree
Showing 32 changed files with 2,936 additions and 0 deletions.
9 changes: 9 additions & 0 deletions azure-mgmt-documentdb/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. :changelog:
Release History
===============

0.0.1 (1970-01-01)
++++++++++++++++++

* Initial Release
3 changes: 3 additions & 0 deletions azure-mgmt-documentdb/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include *.rst
exclude azure/__init__.py
exclude azure/mgmt/__init__.py
49 changes: 49 additions & 0 deletions azure-mgmt-documentdb/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure DocumentDB Management Client Library.

Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.3, 3.4 and 3.5.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.

For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


Compatibility
=============

**IMPORTANT**: If you have an earlier version of the azure package
(version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

.. code:: shell
pip freeze
If you see azure==0.11.0 (or any version below 1.0), uninstall it first:

.. code:: shell
pip uninstall azure
Usage
=====

For code examples, see `DocumentDB Management
<https://azure-sdk-for-python.readthedocs.org/en/latest/sample_azure-mgmt-documentdb.html>`__
on readthedocs.org.


Provide Feedback
================

If you encounter any bugs or have suggestions, please file an issue in the
`Issues <https://github.com/Azure/azure-sdk-for-python/issues>`__
section of the project.
1 change: 1 addition & 0 deletions azure-mgmt-documentdb/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
1 change: 1 addition & 0 deletions azure-mgmt-documentdb/azure/mgmt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
18 changes: 18 additions & 0 deletions azure-mgmt-documentdb/azure/mgmt/documentdb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .document_db import DocumentDB
from .version import VERSION

__all__ = ['DocumentDB']

__version__ = VERSION

91 changes: 91 additions & 0 deletions azure-mgmt-documentdb/azure/mgmt/documentdb/document_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.database_accounts_operations import DatabaseAccountsOperations
from . import models


class DocumentDBConfiguration(AzureConfiguration):
"""Configuration for DocumentDB
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure subscription ID.
:type subscription_id: str
:param api_version: Version of the API to be used with the client request.
The current version is 2015-04-08.
:type api_version: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, api_version='2015-04-08', base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not isinstance(subscription_id, str):
raise TypeError("Parameter 'subscription_id' must be str.")
if api_version is not None and not isinstance(api_version, str):
raise TypeError("Optional parameter 'api_version' must be str.")
if not base_url:
base_url = 'https://management.azure.com'

super(DocumentDBConfiguration, self).__init__(base_url)

self.add_user_agent('documentdb/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id
self.api_version = api_version


class DocumentDB(object):
"""Azure DocumentDB Database Service Resource Provider REST API
:ivar config: Configuration for client.
:vartype config: DocumentDBConfiguration
:ivar database_accounts: DatabaseAccounts operations
:vartype database_accounts: .operations.DatabaseAccountsOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure subscription ID.
:type subscription_id: str
:param api_version: Version of the API to be used with the client request.
The current version is 2015-04-08.
:type api_version: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, api_version='2015-04-08', base_url=None):

self.config = DocumentDBConfiguration(credentials, subscription_id, api_version, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.database_accounts = DatabaseAccountsOperations(
self._client, self.config, self._serialize, self._deserialize)
48 changes: 48 additions & 0 deletions azure-mgmt-documentdb/azure/mgmt/documentdb/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .consistency_policy import ConsistencyPolicy
from .location import Location
from .failover_policy import FailoverPolicy
from .database_account import DatabaseAccount
from .failover_policies import FailoverPolicies
from .resource import Resource
from .database_account_create_update_parameters import DatabaseAccountCreateUpdateParameters
from .database_account_patch_parameters import DatabaseAccountPatchParameters
from .database_account_list_read_only_keys_result import DatabaseAccountListReadOnlyKeysResult
from .database_account_list_keys_result import DatabaseAccountListKeysResult
from .database_account_regenerate_key_parameters import DatabaseAccountRegenerateKeyParameters
from .database_account_paged import DatabaseAccountPaged
from .document_db_enums import (
DatabaseAccountKind,
DatabaseAccountOfferType,
DefaultConsistencyLevel,
KeyKind,
)

__all__ = [
'ConsistencyPolicy',
'Location',
'FailoverPolicy',
'DatabaseAccount',
'FailoverPolicies',
'Resource',
'DatabaseAccountCreateUpdateParameters',
'DatabaseAccountPatchParameters',
'DatabaseAccountListReadOnlyKeysResult',
'DatabaseAccountListKeysResult',
'DatabaseAccountRegenerateKeyParameters',
'DatabaseAccountPaged',
'DatabaseAccountKind',
'DatabaseAccountOfferType',
'DefaultConsistencyLevel',
'KeyKind',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ConsistencyPolicy(Model):
"""The consistency policy for the DocumentDB database account.
:param default_consistency_level: The default consistency level and
configuration settings of the DocumentDB account. Possible values include:
'Eventual', 'Session', 'BoundedStaleness', 'Strong'
:type default_consistency_level: str or :class:`DefaultConsistencyLevel
<azure.mgmt.documentdb.models.DefaultConsistencyLevel>`
:param max_staleness_prefix: When used with the Bounded Staleness
consistency level, this value represents the number of stale requests
tolerated. Accepted range for this value is 1 – 2,147,483,647. Required
when defaultConsistencyPolicy is set to 'BoundedStaleness'.
:type max_staleness_prefix: long
:param max_interval_in_seconds: When used with the Bounded Staleness
consistency level, this value represents the time amount of staleness (in
seconds) tolerated. Accepted range for this value is 1 - 100. Required
when defaultConsistencyPolicy is set to 'BoundedStaleness'.
:type max_interval_in_seconds: int
"""

_validation = {
'default_consistency_level': {'required': True},
'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1},
'max_interval_in_seconds': {'maximum': 100, 'minimum': 1},
}

_attribute_map = {
'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'},
'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'},
'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'},
}

def __init__(self, default_consistency_level, max_staleness_prefix=None, max_interval_in_seconds=None):
self.default_consistency_level = default_consistency_level
self.max_staleness_prefix = max_staleness_prefix
self.max_interval_in_seconds = max_interval_in_seconds
110 changes: 110 additions & 0 deletions azure-mgmt-documentdb/azure/mgmt/documentdb/models/database_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .resource import Resource


class DatabaseAccount(Resource):
"""A DocumentDB database account.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:param location: The location of the resource group to which the resource
belongs.
:type location: str
:param tags:
:type tags: dict
:param kind: Indicates the type of database account. This can only be set
at database account creation. Possible values include: 'GlobalDocumentDB',
'MongoDB', 'Parse'. Default value: "GlobalDocumentDB" .
:type kind: str or :class:`DatabaseAccountKind
<azure.mgmt.documentdb.models.DatabaseAccountKind>`
:param provisioning_state:
:type provisioning_state: str
:ivar document_endpoint: The connection endpoint for the DocumentDB
database account.
:vartype document_endpoint: str
:ivar database_account_offer_type: The offer type for the DocumentDB
database account. Default value: Standard. Possible values include:
'Standard'
:vartype database_account_offer_type: str or
:class:`DatabaseAccountOfferType
<azure.mgmt.documentdb.models.DatabaseAccountOfferType>`
:param ip_range_filter: DocumentDB Firewall Support: This value specifies
the set of IP addresses or IP address ranges in CIDR form to be included
as the allowed list of client IPs for a given database account. IP
addresses/ranges must be comma separated and must not contain any spaces.
:type ip_range_filter: str
:param consistency_policy: The consistency policy for the DocumentDB
database account.
:type consistency_policy: :class:`ConsistencyPolicy
<azure.mgmt.documentdb.models.ConsistencyPolicy>`
:ivar write_locations: An array that contains the write location for the
DocumentDB account.
:vartype write_locations: list of :class:`Location
<azure.mgmt.documentdb.models.Location>`
:ivar read_locations: An array that contains of the read locations enabled
for the DocumentDB account.
:vartype read_locations: list of :class:`Location
<azure.mgmt.documentdb.models.Location>`
:ivar failover_policies: An array that contains the regions ordered by
their failover priorities.
:vartype failover_policies: list of :class:`FailoverPolicy
<azure.mgmt.documentdb.models.FailoverPolicy>`
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'document_endpoint': {'readonly': True},
'database_account_offer_type': {'readonly': True},
'write_locations': {'readonly': True},
'read_locations': {'readonly': True},
'failover_policies': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'kind': {'key': 'kind', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'document_endpoint': {'key': 'properties.documentEndpoint', 'type': 'str'},
'database_account_offer_type': {'key': 'properties.databaseAccountOfferType', 'type': 'DatabaseAccountOfferType'},
'ip_range_filter': {'key': 'properties.ipRangeFilter', 'type': 'str'},
'consistency_policy': {'key': 'properties.consistencyPolicy', 'type': 'ConsistencyPolicy'},
'write_locations': {'key': 'properties.writeLocations', 'type': '[Location]'},
'read_locations': {'key': 'properties.readLocations', 'type': '[Location]'},
'failover_policies': {'key': 'properties.failoverPolicies', 'type': '[FailoverPolicy]'},
}

def __init__(self, location, tags=None, kind="GlobalDocumentDB", provisioning_state=None, ip_range_filter=None, consistency_policy=None):
super(DatabaseAccount, self).__init__(location=location, tags=tags)
self.kind = kind
self.provisioning_state = provisioning_state
self.document_endpoint = None
self.database_account_offer_type = None
self.ip_range_filter = ip_range_filter
self.consistency_policy = consistency_policy
self.write_locations = None
self.read_locations = None
self.failover_policies = None
Loading

0 comments on commit 2a93c1a

Please sign in to comment.