Skip to content

Commit 400c0c2

Browse files
[AutoRelease] t2-cosmosdbforpostgresql-2024-02-28-31084(can only be merged by SDK owner) (#34485)
* code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]>
1 parent 26137ce commit 400c0c2

File tree

70 files changed

+574
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+574
-115
lines changed

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Release History
22

3+
## 1.1.0b1 (2024-03-18)
4+
5+
### Features Added
6+
7+
- Model Cluster has a new parameter auth_config
8+
- Model Cluster has a new parameter database_name
9+
- Model Cluster has a new parameter enable_geo_backup
10+
- Model Role has a new parameter object_id
11+
- Model Role has a new parameter principal_type
12+
- Model Role has a new parameter role_type
13+
- Model Role has a new parameter tenant_id
14+
- Operation ClustersOperations.begin_promote_read_replica has a new optional parameter promote_request
15+
316
## 1.0.0 (2023-09-20)
417

518
### Other Changes

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Cosmosdbforpostgresql Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.8+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -59,6 +59,3 @@ Code samples for this package can be found at:
5959
If you encounter any bugs or have suggestions, please file an issue in the
6060
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6161
section of the project.
62-
63-
64-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-cosmosdbforpostgresql%2FREADME.png)

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"commit": "b646a42aa3b7a0ce488d05f1724827ea41d12cf1",
2+
"commit": "77df3b1680a95566a3e6a3a2cd07c9a4960b2af3",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.9.7",
55
"use": [
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"AssetsRepo": "Azure/azure-sdk-assets",
3+
"AssetsRepoPrefixPath": "python",
4+
"TagPrefix": "python/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql",
5+
"Tag": "python/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql_cdd94fdb03"
6+
}

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/azure/mgmt/cosmosdbforpostgresql/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ class CosmosdbForPostgresqlMgmtClientConfiguration(Configuration): # pylint: di
2929
:type credential: ~azure.core.credentials.TokenCredential
3030
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3131
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2022-11-08". Note that overriding this
33-
default value may result in unsupported behavior.
32+
:keyword api_version: Api Version. Default value is "2023-03-02-preview". Note that overriding
33+
this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

3737
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
3838
super(CosmosdbForPostgresqlMgmtClientConfiguration, self).__init__(**kwargs)
39-
api_version: str = kwargs.pop("api_version", "2022-11-08")
39+
api_version: str = kwargs.pop("api_version", "2023-03-02-preview")
4040

4141
if credential is None:
4242
raise ValueError("Parameter 'credential' must not be None.")

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/azure/mgmt/cosmosdbforpostgresql/_cosmosdb_for_postgresql_mgmt_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class CosmosdbForPostgresqlMgmtClient: # pylint: disable=client-accepts-api-ver
5858
:type subscription_id: str
5959
:param base_url: Service URL. Default value is "https://management.azure.com".
6060
:type base_url: str
61-
:keyword api_version: Api Version. Default value is "2022-11-08". Note that overriding this
62-
default value may result in unsupported behavior.
61+
:keyword api_version: Api Version. Default value is "2023-03-02-preview". Note that overriding
62+
this default value may result in unsupported behavior.
6363
:paramtype api_version: str
6464
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6565
Retry-After header is present.

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/azure/mgmt/cosmosdbforpostgresql/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0"
9+
VERSION = "1.1.0b1"

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/azure/mgmt/cosmosdbforpostgresql/aio/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ class CosmosdbForPostgresqlMgmtClientConfiguration(Configuration): # pylint: di
2929
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
3030
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3131
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2022-11-08". Note that overriding this
33-
default value may result in unsupported behavior.
32+
:keyword api_version: Api Version. Default value is "2023-03-02-preview". Note that overriding
33+
this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

3737
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
3838
super(CosmosdbForPostgresqlMgmtClientConfiguration, self).__init__(**kwargs)
39-
api_version: str = kwargs.pop("api_version", "2022-11-08")
39+
api_version: str = kwargs.pop("api_version", "2023-03-02-preview")
4040

4141
if credential is None:
4242
raise ValueError("Parameter 'credential' must not be None.")

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/azure/mgmt/cosmosdbforpostgresql/aio/_cosmosdb_for_postgresql_mgmt_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class CosmosdbForPostgresqlMgmtClient: # pylint: disable=client-accepts-api-ver
6060
:type subscription_id: str
6161
:param base_url: Service URL. Default value is "https://management.azure.com".
6262
:type base_url: str
63-
:keyword api_version: Api Version. Default value is "2022-11-08". Note that overriding this
64-
default value may result in unsupported behavior.
63+
:keyword api_version: Api Version. Default value is "2023-03-02-preview". Note that overriding
64+
this default value may result in unsupported behavior.
6565
:paramtype api_version: str
6666
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6767
Retry-After header is present.

sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/azure/mgmt/cosmosdbforpostgresql/aio/operations/_clusters_operations.py

Lines changed: 108 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
12501250
}
12511251

12521252
async def _promote_read_replica_initial( # pylint: disable=inconsistent-return-statements
1253-
self, resource_group_name: str, cluster_name: str, **kwargs: Any
1253+
self,
1254+
resource_group_name: str,
1255+
cluster_name: str,
1256+
promote_request: Optional[Union[_models.PromoteRequest, IO]] = None,
1257+
**kwargs: Any
12541258
) -> None:
12551259
error_map = {
12561260
401: ClientAuthenticationError,
@@ -1260,17 +1264,32 @@ async def _promote_read_replica_initial( # pylint: disable=inconsistent-return-
12601264
}
12611265
error_map.update(kwargs.pop("error_map", {}) or {})
12621266

1263-
_headers = kwargs.pop("headers", {}) or {}
1267+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
12641268
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
12651269

12661270
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
1271+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
12671272
cls: ClsType[None] = kwargs.pop("cls", None)
12681273

1274+
content_type = content_type or "application/json"
1275+
_json = None
1276+
_content = None
1277+
if isinstance(promote_request, (IOBase, bytes)):
1278+
_content = promote_request
1279+
else:
1280+
if promote_request is not None:
1281+
_json = self._serialize.body(promote_request, "PromoteRequest")
1282+
else:
1283+
_json = None
1284+
12691285
request = build_promote_read_replica_request(
12701286
resource_group_name=resource_group_name,
12711287
cluster_name=cluster_name,
12721288
subscription_id=self._config.subscription_id,
12731289
api_version=api_version,
1290+
content_type=content_type,
1291+
json=_json,
1292+
content=_content,
12741293
template_url=self._promote_read_replica_initial.metadata["url"],
12751294
headers=_headers,
12761295
params=_params,
@@ -1303,9 +1322,85 @@ async def _promote_read_replica_initial( # pylint: disable=inconsistent-return-
13031322
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/promote"
13041323
}
13051324

1325+
@overload
1326+
async def begin_promote_read_replica(
1327+
self,
1328+
resource_group_name: str,
1329+
cluster_name: str,
1330+
promote_request: Optional[_models.PromoteRequest] = None,
1331+
*,
1332+
content_type: str = "application/json",
1333+
**kwargs: Any
1334+
) -> AsyncLROPoller[None]:
1335+
"""Promotes read replica cluster to an independent read-write cluster.
1336+
1337+
:param resource_group_name: The name of the resource group. The name is case insensitive.
1338+
Required.
1339+
:type resource_group_name: str
1340+
:param cluster_name: The name of the cluster. Required.
1341+
:type cluster_name: str
1342+
:param promote_request: The parameter for enabling geo-redundant backup while promoting read
1343+
replica. Default value is None.
1344+
:type promote_request: ~azure.mgmt.cosmosdbforpostgresql.models.PromoteRequest
1345+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1346+
Default value is "application/json".
1347+
:paramtype content_type: str
1348+
:keyword callable cls: A custom type or function that will be passed the direct response
1349+
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
1350+
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
1351+
this operation to not poll, or pass in your own initialized polling object for a personal
1352+
polling strategy.
1353+
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
1354+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
1355+
Retry-After header is present.
1356+
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
1357+
:rtype: ~azure.core.polling.AsyncLROPoller[None]
1358+
:raises ~azure.core.exceptions.HttpResponseError:
1359+
"""
1360+
1361+
@overload
1362+
async def begin_promote_read_replica(
1363+
self,
1364+
resource_group_name: str,
1365+
cluster_name: str,
1366+
promote_request: Optional[IO] = None,
1367+
*,
1368+
content_type: str = "application/json",
1369+
**kwargs: Any
1370+
) -> AsyncLROPoller[None]:
1371+
"""Promotes read replica cluster to an independent read-write cluster.
1372+
1373+
:param resource_group_name: The name of the resource group. The name is case insensitive.
1374+
Required.
1375+
:type resource_group_name: str
1376+
:param cluster_name: The name of the cluster. Required.
1377+
:type cluster_name: str
1378+
:param promote_request: The parameter for enabling geo-redundant backup while promoting read
1379+
replica. Default value is None.
1380+
:type promote_request: IO
1381+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1382+
Default value is "application/json".
1383+
:paramtype content_type: str
1384+
:keyword callable cls: A custom type or function that will be passed the direct response
1385+
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
1386+
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
1387+
this operation to not poll, or pass in your own initialized polling object for a personal
1388+
polling strategy.
1389+
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
1390+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
1391+
Retry-After header is present.
1392+
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
1393+
:rtype: ~azure.core.polling.AsyncLROPoller[None]
1394+
:raises ~azure.core.exceptions.HttpResponseError:
1395+
"""
1396+
13061397
@distributed_trace_async
13071398
async def begin_promote_read_replica(
1308-
self, resource_group_name: str, cluster_name: str, **kwargs: Any
1399+
self,
1400+
resource_group_name: str,
1401+
cluster_name: str,
1402+
promote_request: Optional[Union[_models.PromoteRequest, IO]] = None,
1403+
**kwargs: Any
13091404
) -> AsyncLROPoller[None]:
13101405
"""Promotes read replica cluster to an independent read-write cluster.
13111406
@@ -1314,6 +1409,12 @@ async def begin_promote_read_replica(
13141409
:type resource_group_name: str
13151410
:param cluster_name: The name of the cluster. Required.
13161411
:type cluster_name: str
1412+
:param promote_request: The parameter for enabling geo-redundant backup while promoting read
1413+
replica. Is either a PromoteRequest type or a IO type. Default value is None.
1414+
:type promote_request: ~azure.mgmt.cosmosdbforpostgresql.models.PromoteRequest or IO
1415+
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1416+
Default value is None.
1417+
:paramtype content_type: str
13171418
:keyword callable cls: A custom type or function that will be passed the direct response
13181419
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
13191420
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
@@ -1326,10 +1427,11 @@ async def begin_promote_read_replica(
13261427
:rtype: ~azure.core.polling.AsyncLROPoller[None]
13271428
:raises ~azure.core.exceptions.HttpResponseError:
13281429
"""
1329-
_headers = kwargs.pop("headers", {}) or {}
1430+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
13301431
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
13311432

13321433
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
1434+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
13331435
cls: ClsType[None] = kwargs.pop("cls", None)
13341436
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
13351437
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
@@ -1338,7 +1440,9 @@ async def begin_promote_read_replica(
13381440
raw_result = await self._promote_read_replica_initial( # type: ignore
13391441
resource_group_name=resource_group_name,
13401442
cluster_name=cluster_name,
1443+
promote_request=promote_request,
13411444
api_version=api_version,
1445+
content_type=content_type,
13421446
cls=lambda x, y, z: x,
13431447
headers=_headers,
13441448
params=_params,

0 commit comments

Comments
 (0)