Skip to content

Commit 7b1652e

Browse files
AutorestCIlmazuel
authored andcommitted
azure-mgmt-cosmosdb 0.4.1 (#2556)
* [AutoPR cosmos-db/resource-manager] Swagger changes to introduce REST APIs for offline and online region for the Cosmos DB account (#2481) * Generated from f874740b2a678460b05083d316f0332701c43df7 fix the compiling error for the json * Generated from fa9bc3028e4c1394bab3ee2c29bcfaaae752cb1b define a new region parameter for online/offline * Generated from ab30108303e8b0af64abcac225babb39f1040974 actually fixing the bug where the region parameter was part of query instead of body * Generated from f2366fb3019c4625f0351dbf06bf4af52c814f6c another try to specify the correct swagger changes * Generated from 90571350169f9fa1de9d74a9588479d776cae2b8 Added default error response * Latest Autorest fixes * CosmosDB packaging 0.4.1
1 parent a8ff936 commit 7b1652e

14 files changed

+364
-9
lines changed

azure-mgmt-cosmosdb/HISTORY.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
Release History
44
===============
55

6+
0.4.1 (2018-05-15)
7+
++++++++++++++++++
8+
9+
**Features**
10+
11+
- Add database_accounts.offline_region
12+
- Add database_accounts.online_region
13+
- Client class can be used as a context manager to keep the underlying HTTP session open for performance
14+
615
0.4.0 (2018-04-17)
716
++++++++++++++++++
817

azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/cosmos_db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from msrest.service_client import ServiceClient
12+
from msrest.service_client import SDKClient
1313
from msrest import Serializer, Deserializer
1414
from msrestazure import AzureConfiguration
1515
from .version import VERSION
@@ -61,7 +61,7 @@ def __init__(
6161
self.subscription_id = subscription_id
6262

6363

64-
class CosmosDB(object):
64+
class CosmosDB(SDKClient):
6565
"""Azure Cosmos DB Database Service Resource Provider REST API
6666
6767
:ivar config: Configuration for client.
@@ -106,7 +106,7 @@ def __init__(
106106
self, credentials, subscription_id, base_url=None):
107107

108108
self.config = CosmosDBConfiguration(credentials, subscription_id, base_url)
109-
self._client = ServiceClient(self.config.credentials, self.config)
109+
super(CosmosDB, self).__init__(self.config.credentials, self.config)
110110

111111
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
112112
self.api_version = '2015-04-08'

azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
from .failover_policy_py3 import FailoverPolicy
1717
from .virtual_network_rule_py3 import VirtualNetworkRule
1818
from .database_account_py3 import DatabaseAccount
19+
from .error_response_py3 import ErrorResponse, ErrorResponseException
1920
from .failover_policies_py3 import FailoverPolicies
21+
from .region_for_online_offline_py3 import RegionForOnlineOffline
2022
from .resource_py3 import Resource
2123
from .database_account_create_update_parameters_py3 import DatabaseAccountCreateUpdateParameters
2224
from .database_account_patch_parameters_py3 import DatabaseAccountPatchParameters
@@ -44,7 +46,9 @@
4446
from .failover_policy import FailoverPolicy
4547
from .virtual_network_rule import VirtualNetworkRule
4648
from .database_account import DatabaseAccount
49+
from .error_response import ErrorResponse, ErrorResponseException
4750
from .failover_policies import FailoverPolicies
51+
from .region_for_online_offline import RegionForOnlineOffline
4852
from .resource import Resource
4953
from .database_account_create_update_parameters import DatabaseAccountCreateUpdateParameters
5054
from .database_account_patch_parameters import DatabaseAccountPatchParameters
@@ -89,7 +93,9 @@
8993
'FailoverPolicy',
9094
'VirtualNetworkRule',
9195
'DatabaseAccount',
96+
'ErrorResponse', 'ErrorResponseException',
9297
'FailoverPolicies',
98+
'RegionForOnlineOffline',
9399
'Resource',
94100
'DatabaseAccountCreateUpdateParameters',
95101
'DatabaseAccountPatchParameters',

azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_create_update_parameters_py3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from .resource import Resource
12+
from .resource_py3 import Resource
1313

1414

1515
class DatabaseAccountCreateUpdateParameters(Resource):

azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account_py3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from .resource import Resource
12+
from .resource_py3 import Resource
1313

1414

1515
class DatabaseAccount(Resource):
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
from msrest.exceptions import HttpOperationError
14+
15+
16+
class ErrorResponse(Model):
17+
"""Error Response.
18+
19+
:param code: Error code.
20+
:type code: str
21+
:param message: Error message indicating why the operation failed.
22+
:type message: str
23+
"""
24+
25+
_attribute_map = {
26+
'code': {'key': 'code', 'type': 'str'},
27+
'message': {'key': 'message', 'type': 'str'},
28+
}
29+
30+
def __init__(self, **kwargs):
31+
super(ErrorResponse, self).__init__(**kwargs)
32+
self.code = kwargs.get('code', None)
33+
self.message = kwargs.get('message', None)
34+
35+
36+
class ErrorResponseException(HttpOperationError):
37+
"""Server responsed with exception of type: 'ErrorResponse'.
38+
39+
:param deserialize: A deserializer
40+
:param response: Server response to be deserialized.
41+
"""
42+
43+
def __init__(self, deserialize, response, *args):
44+
45+
super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
from msrest.exceptions import HttpOperationError
14+
15+
16+
class ErrorResponse(Model):
17+
"""Error Response.
18+
19+
:param code: Error code.
20+
:type code: str
21+
:param message: Error message indicating why the operation failed.
22+
:type message: str
23+
"""
24+
25+
_attribute_map = {
26+
'code': {'key': 'code', 'type': 'str'},
27+
'message': {'key': 'message', 'type': 'str'},
28+
}
29+
30+
def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None:
31+
super(ErrorResponse, self).__init__(**kwargs)
32+
self.code = code
33+
self.message = message
34+
35+
36+
class ErrorResponseException(HttpOperationError):
37+
"""Server responsed with exception of type: 'ErrorResponse'.
38+
39+
:param deserialize: A deserializer
40+
:param response: Server response to be deserialized.
41+
"""
42+
43+
def __init__(self, deserialize, response, *args):
44+
45+
super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)

azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/partition_metric_py3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from .metric import Metric
12+
from .metric_py3 import Metric
1313

1414

1515
class PartitionMetric(Metric):

azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/partition_usage_py3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from .usage import Usage
12+
from .usage_py3 import Usage
1313

1414

1515
class PartitionUsage(Usage):

azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/percentile_metric_value_py3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from .metric_value import MetricValue
12+
from .metric_value_py3 import MetricValue
1313

1414

1515
class PercentileMetricValue(MetricValue):
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
14+
15+
class RegionForOnlineOffline(Model):
16+
"""Cosmos DB region to online or offline.
17+
18+
All required parameters must be populated in order to send to Azure.
19+
20+
:param region: Required. Cosmos DB region, with spaces between words and
21+
each word capitalized.
22+
:type region: str
23+
"""
24+
25+
_validation = {
26+
'region': {'required': True},
27+
}
28+
29+
_attribute_map = {
30+
'region': {'key': 'region', 'type': 'str'},
31+
}
32+
33+
def __init__(self, **kwargs):
34+
super(RegionForOnlineOffline, self).__init__(**kwargs)
35+
self.region = kwargs.get('region', None)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
14+
15+
class RegionForOnlineOffline(Model):
16+
"""Cosmos DB region to online or offline.
17+
18+
All required parameters must be populated in order to send to Azure.
19+
20+
:param region: Required. Cosmos DB region, with spaces between words and
21+
each word capitalized.
22+
:type region: str
23+
"""
24+
25+
_validation = {
26+
'region': {'required': True},
27+
}
28+
29+
_attribute_map = {
30+
'region': {'key': 'region', 'type': 'str'},
31+
}
32+
33+
def __init__(self, *, region: str, **kwargs) -> None:
34+
super(RegionForOnlineOffline, self).__init__(**kwargs)
35+
self.region = region

0 commit comments

Comments
 (0)