Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] cosmos-db/resource-manager #2235

Merged
merged 4 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions azure-mgmt-cosmosdb/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@
Release History
===============

0.4.0 (2018-04-17)
++++++++++++++++++

**General Breaking changes**

This version uses a next-generation code generator that *might* introduce breaking changes.

- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments.
To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered.
While this is not a breaking change, the distinctions are important, and are documented here:
https://docs.python.org/3/library/enum.html#others
At a glance:

- "is" should not be used at all.
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered.

- New Long Running Operation:

- Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same.
- Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used.
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`.
- New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`,
the response of the initial call will be returned without polling.
- `polling` parameter accepts instances of subclasses of `msrest.polling.PollingMethod`.
- `add_done_callback` will no longer raise if called after polling is finished, but will instead execute the callback right away.

**Bugfixes**

- Compatibility of the sdist with wheel 0.31.0

**Features**

- Add VNet related properties to CosmosDB


0.3.1 (2018-02-01)
++++++++++++++++++

Expand Down
83 changes: 57 additions & 26 deletions azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,62 @@
# regenerated.
# --------------------------------------------------------------------------

from .consistency_policy import ConsistencyPolicy
from .capability import Capability
from .location import Location
from .failover_policy import FailoverPolicy
from .database_account import DatabaseAccount
from .failover_policies import FailoverPolicies
from .resource import Resource
from .database_account_create_update_parameters import DatabaseAccountCreateUpdateParameters
from .database_account_patch_parameters import DatabaseAccountPatchParameters
from .database_account_list_read_only_keys_result import DatabaseAccountListReadOnlyKeysResult
from .database_account_list_keys_result import DatabaseAccountListKeysResult
from .database_account_connection_string import DatabaseAccountConnectionString
from .database_account_list_connection_strings_result import DatabaseAccountListConnectionStringsResult
from .database_account_regenerate_key_parameters import DatabaseAccountRegenerateKeyParameters
from .operation_display import OperationDisplay
from .operation import Operation
from .metric_name import MetricName
from .usage import Usage
from .partition_usage import PartitionUsage
from .metric_availability import MetricAvailability
from .metric_definition import MetricDefinition
from .metric_value import MetricValue
from .metric import Metric
from .percentile_metric_value import PercentileMetricValue
from .percentile_metric import PercentileMetric
from .partition_metric import PartitionMetric
try:
from .consistency_policy_py3 import ConsistencyPolicy
from .capability_py3 import Capability
from .location_py3 import Location
from .failover_policy_py3 import FailoverPolicy
from .virtual_network_rule_py3 import VirtualNetworkRule
from .database_account_py3 import DatabaseAccount
from .failover_policies_py3 import FailoverPolicies
from .resource_py3 import Resource
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
from .database_account_list_keys_result_py3 import DatabaseAccountListKeysResult
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 .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
from .metric_name_py3 import MetricName
from .usage_py3 import Usage
from .partition_usage_py3 import PartitionUsage
from .metric_availability_py3 import MetricAvailability
from .metric_definition_py3 import MetricDefinition
from .metric_value_py3 import MetricValue
from .metric_py3 import Metric
from .percentile_metric_value_py3 import PercentileMetricValue
from .percentile_metric_py3 import PercentileMetric
from .partition_metric_py3 import PartitionMetric
except (SyntaxError, ImportError):
from .consistency_policy import ConsistencyPolicy
from .capability import Capability
from .location import Location
from .failover_policy import FailoverPolicy
from .virtual_network_rule import VirtualNetworkRule
from .database_account import DatabaseAccount
from .failover_policies import FailoverPolicies
from .resource import Resource
from .database_account_create_update_parameters import DatabaseAccountCreateUpdateParameters
from .database_account_patch_parameters import DatabaseAccountPatchParameters
from .database_account_list_read_only_keys_result import DatabaseAccountListReadOnlyKeysResult
from .database_account_list_keys_result import DatabaseAccountListKeysResult
from .database_account_connection_string import DatabaseAccountConnectionString
from .database_account_list_connection_strings_result import DatabaseAccountListConnectionStringsResult
from .database_account_regenerate_key_parameters import DatabaseAccountRegenerateKeyParameters
from .operation_display import OperationDisplay
from .operation import Operation
from .metric_name import MetricName
from .usage import Usage
from .partition_usage import PartitionUsage
from .metric_availability import MetricAvailability
from .metric_definition import MetricDefinition
from .metric_value import MetricValue
from .metric import Metric
from .percentile_metric_value import PercentileMetricValue
from .percentile_metric import PercentileMetric
from .partition_metric import PartitionMetric
from .database_account_paged import DatabaseAccountPaged
from .metric_paged import MetricPaged
from .usage_paged import UsagePaged
Expand All @@ -57,6 +87,7 @@
'Capability',
'Location',
'FailoverPolicy',
'VirtualNetworkRule',
'DatabaseAccount',
'FailoverPolicies',
'Resource',
Expand Down
10 changes: 6 additions & 4 deletions azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
class Capability(Model):
"""Cosmos DB capability object.

:param name: Name of the Cosmos DB capability
:param name: Name of the Cosmos DB capability. For example, "name":
"EnableCassandra". Current values also include "EnableTable" and
"EnableGremlin".
:type name: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}

def __init__(self, name=None):
super(Capability, self).__init__()
self.name = name
def __init__(self, **kwargs):
super(Capability, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
30 changes: 30 additions & 0 deletions azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/capability_py3.py
Original file line number Diff line number Diff line change
@@ -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 Capability(Model):
"""Cosmos DB capability object.

:param name: Name of the Cosmos DB capability. For example, "name":
"EnableCassandra". Current values also include "EnableTable" and
"EnableGremlin".
:type name: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}

def __init__(self, *, name: str=None, **kwargs) -> None:
super(Capability, self).__init__(**kwargs)
self.name = name
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
class ConsistencyPolicy(Model):
"""The consistency policy for the Cosmos DB database account.

:param default_consistency_level: The default consistency level and
configuration settings of the Cosmos DB account. Possible values include:
'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix'
All required parameters must be populated in order to send to Azure.

:param default_consistency_level: Required. The default consistency level
and configuration settings of the Cosmos DB account. Possible values
include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong',
'ConsistentPrefix'
:type default_consistency_level: str or
~azure.mgmt.cosmosdb.models.DefaultConsistencyLevel
:param max_staleness_prefix: When used with the Bounded Staleness
Expand All @@ -44,8 +47,8 @@ class ConsistencyPolicy(Model):
'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'},
}

def __init__(self, default_consistency_level, max_staleness_prefix=None, max_interval_in_seconds=None):
super(ConsistencyPolicy, self).__init__()
self.default_consistency_level = default_consistency_level
self.max_staleness_prefix = max_staleness_prefix
self.max_interval_in_seconds = max_interval_in_seconds
def __init__(self, **kwargs):
super(ConsistencyPolicy, self).__init__(**kwargs)
self.default_consistency_level = kwargs.get('default_consistency_level', None)
self.max_staleness_prefix = kwargs.get('max_staleness_prefix', None)
self.max_interval_in_seconds = kwargs.get('max_interval_in_seconds', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ConsistencyPolicy(Model):
"""The consistency policy for the Cosmos DB database account.

All required parameters must be populated in order to send to Azure.

:param default_consistency_level: Required. The default consistency level
and configuration settings of the Cosmos DB account. Possible values
include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong',
'ConsistentPrefix'
:type default_consistency_level: str or
~azure.mgmt.cosmosdb.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 5 - 86400. 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': 86400, 'minimum': 5},
}

_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: int=None, max_interval_in_seconds: int=None, **kwargs) -> None:
super(ConsistencyPolicy, self).__init__(**kwargs)
self.default_consistency_level = default_consistency_level
self.max_staleness_prefix = max_staleness_prefix
self.max_interval_in_seconds = max_interval_in_seconds
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
from enum import Enum


class DatabaseAccountKind(Enum):
class DatabaseAccountKind(str, Enum):

global_document_db = "GlobalDocumentDB"
mongo_db = "MongoDB"
parse = "Parse"


class DatabaseAccountOfferType(Enum):
class DatabaseAccountOfferType(str, Enum):

standard = "Standard"


class DefaultConsistencyLevel(Enum):
class DefaultConsistencyLevel(str, Enum):

eventual = "Eventual"
session = "Session"
Expand All @@ -33,15 +33,15 @@ class DefaultConsistencyLevel(Enum):
consistent_prefix = "ConsistentPrefix"


class KeyKind(Enum):
class KeyKind(str, Enum):

primary = "primary"
secondary = "secondary"
primary_readonly = "primaryReadonly"
secondary_readonly = "secondaryReadonly"


class UnitType(Enum):
class UnitType(str, Enum):

count = "Count"
bytes = "Bytes"
Expand All @@ -52,7 +52,7 @@ class UnitType(Enum):
milliseconds = "Milliseconds"


class PrimaryAggregationType(Enum):
class PrimaryAggregationType(str, Enum):

none = "None"
average = "Average"
Expand Down
Loading