Skip to content

Commit bd8c8db

Browse files
azure-sdkChenxiJiang333
authored andcommitted
[AutoRelease] t2-postgresqlflexibleservers-2024-10-30-49242(can only be merged by SDK owner) (Azure#38188)
* code and test * update-testcase * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]>
1 parent 2600d09 commit bd8c8db

File tree

141 files changed

+2344
-224
lines changed

Some content is hidden

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

141 files changed

+2344
-224
lines changed

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

+44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
# Release History
22

3+
## 1.1.0b1 (2024-11-04)
4+
5+
### Features Added
6+
7+
- Client `PostgreSQLManagementClient` added operation group `quota_usages`
8+
- Client `PostgreSQLManagementClient` added operation group `tuning_options`
9+
- Model `FlexibleServerCapability` added property `supported_features`
10+
- Enum `IdentityType` added member `SYSTEM_ASSIGNED`
11+
- Model `Server` added property `cluster`
12+
- Model `ServerSkuCapability` added property `supported_features`
13+
- Model `ServerSkuCapability` added property `security_profile`
14+
- Enum `ServerVersion` added member `SEVENTEEN`
15+
- Model `ServerVersionCapability` added property `supported_features`
16+
- Enum `SourceType` added member `APSARA_DB_RDS`
17+
- Enum `SourceType` added member `CRUNCHY_POSTGRE_SQL`
18+
- Enum `SourceType` added member `DIGITAL_OCEAN_DROPLETS`
19+
- Enum `SourceType` added member `DIGITAL_OCEAN_POSTGRE_SQL`
20+
- Enum `SourceType` added member `EDB_ORACLE_SERVER`
21+
- Enum `SourceType` added member `EDB_POSTGRE_SQL`
22+
- Enum `SourceType` added member `HEROKU_POSTGRE_SQL`
23+
- Enum `SourceType` added member `HUAWEI_COMPUTE`
24+
- Enum `SourceType` added member `HUAWEI_RDS`
25+
- Enum `SourceType` added member `POSTGRE_SQL_COSMOS_DB`
26+
- Enum `SourceType` added member `POSTGRE_SQL_FLEXIBLE_SERVER`
27+
- Enum `SourceType` added member `SUPABASE_POSTGRE_SQL`
28+
- Enum `StorageType` added member `ULTRA_SSD_LRS`
29+
- Added model `Cluster`
30+
- Added model `ImpactRecord`
31+
- Added model `IndexRecommendationDetails`
32+
- Added model `IndexRecommendationListResult`
33+
- Added model `IndexRecommendationResource`
34+
- Added model `IndexRecommendationResourcePropertiesAnalyzedWorkload`
35+
- Added model `IndexRecommendationResourcePropertiesImplementationDetails`
36+
- Added model `NameProperty`
37+
- Added model `QuotaUsage`
38+
- Added model `QuotaUsagesListResult`
39+
- Added enum `RecommendationType`
40+
- Added enum `RecommendationTypeEnum`
41+
- Added model `SupportedFeature`
42+
- Added enum `SupportedFeatureStatusEnum`
43+
- Added enum `TuningOptionEnum`
44+
- Added model `TuningOptionsListResult`
45+
- Added model `TuningOptionsResource`
46+
347
## 1.0.0 (2024-10-11)
448

549
### Features Added
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "9a8af2acfafc4d7a23eff41b859d2d332f51b0bc",
2+
"commit": "8abf88fb9caa0bfea8d4026a4b7628bbe47961ed",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.10.2",
55
"use": [
66
"@autorest/[email protected]",
77
"@autorest/[email protected]"
88
],
9-
"autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-flexibleserver-2024-08-01 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-flexibleserver-2024-11-01-preview --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/postgresql/resource-manager/readme.md"
1111
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-insta
2828
:type credential: ~azure.core.credentials.TokenCredential
2929
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3030
:type subscription_id: str
31-
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
32-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
3333
:paramtype api_version: str
3434
"""
3535

3636
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
37-
api_version: str = kwargs.pop("api_version", "2024-08-01")
37+
api_version: str = kwargs.pop("api_version", "2024-11-01-preview")
3838

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

sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_postgre_sql_management_client.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@
3737
PrivateEndpointConnectionOperations,
3838
PrivateEndpointConnectionsOperations,
3939
PrivateLinkResourcesOperations,
40+
QuotaUsagesOperations,
4041
ReplicasOperations,
4142
ServerCapabilitiesOperations,
4243
ServerThreatProtectionSettingsOperations,
4344
ServersOperations,
45+
TuningOptionsOperations,
4446
VirtualEndpointsOperations,
4547
VirtualNetworkSubnetUsageOperations,
4648
)
@@ -107,13 +109,18 @@ class PostgreSQLManagementClient(
107109
:ivar private_link_resources: PrivateLinkResourcesOperations operations
108110
:vartype private_link_resources:
109111
azure.mgmt.postgresqlflexibleservers.operations.PrivateLinkResourcesOperations
112+
:ivar quota_usages: QuotaUsagesOperations operations
113+
:vartype quota_usages: azure.mgmt.postgresqlflexibleservers.operations.QuotaUsagesOperations
110114
:ivar replicas: ReplicasOperations operations
111115
:vartype replicas: azure.mgmt.postgresqlflexibleservers.operations.ReplicasOperations
112116
:ivar log_files: LogFilesOperations operations
113117
:vartype log_files: azure.mgmt.postgresqlflexibleservers.operations.LogFilesOperations
114118
:ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations
115119
:vartype server_threat_protection_settings:
116120
azure.mgmt.postgresqlflexibleservers.operations.ServerThreatProtectionSettingsOperations
121+
:ivar tuning_options: TuningOptionsOperations operations
122+
:vartype tuning_options:
123+
azure.mgmt.postgresqlflexibleservers.operations.TuningOptionsOperations
117124
:ivar virtual_endpoints: VirtualEndpointsOperations operations
118125
:vartype virtual_endpoints:
119126
azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations
@@ -126,8 +133,8 @@ class PostgreSQLManagementClient(
126133
:type subscription_id: str
127134
:param base_url: Service URL. Default value is "https://management.azure.com".
128135
:type base_url: str
129-
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
130-
default value may result in unsupported behavior.
136+
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
137+
this default value may result in unsupported behavior.
131138
:paramtype api_version: str
132139
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
133140
Retry-After header is present.
@@ -203,11 +210,13 @@ def __init__(
203210
self.private_link_resources = PrivateLinkResourcesOperations(
204211
self._client, self._config, self._serialize, self._deserialize
205212
)
213+
self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize)
206214
self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize)
207215
self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize)
208216
self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations(
209217
self._client, self._config, self._serialize, self._deserialize
210218
)
219+
self.tuning_options = TuningOptionsOperations(self._client, self._config, self._serialize, self._deserialize)
211220
self.virtual_endpoints = VirtualEndpointsOperations(
212221
self._client, self._config, self._serialize, self._deserialize
213222
)

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

+1-1
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/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_configuration.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-insta
2828
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
2929
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3030
:type subscription_id: str
31-
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
32-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
3333
:paramtype api_version: str
3434
"""
3535

3636
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
37-
api_version: str = kwargs.pop("api_version", "2024-08-01")
37+
api_version: str = kwargs.pop("api_version", "2024-11-01-preview")
3838

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

sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_postgre_sql_management_client.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@
3737
PrivateEndpointConnectionOperations,
3838
PrivateEndpointConnectionsOperations,
3939
PrivateLinkResourcesOperations,
40+
QuotaUsagesOperations,
4041
ReplicasOperations,
4142
ServerCapabilitiesOperations,
4243
ServerThreatProtectionSettingsOperations,
4344
ServersOperations,
45+
TuningOptionsOperations,
4446
VirtualEndpointsOperations,
4547
VirtualNetworkSubnetUsageOperations,
4648
)
@@ -107,13 +109,19 @@ class PostgreSQLManagementClient(
107109
:ivar private_link_resources: PrivateLinkResourcesOperations operations
108110
:vartype private_link_resources:
109111
azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateLinkResourcesOperations
112+
:ivar quota_usages: QuotaUsagesOperations operations
113+
:vartype quota_usages:
114+
azure.mgmt.postgresqlflexibleservers.aio.operations.QuotaUsagesOperations
110115
:ivar replicas: ReplicasOperations operations
111116
:vartype replicas: azure.mgmt.postgresqlflexibleservers.aio.operations.ReplicasOperations
112117
:ivar log_files: LogFilesOperations operations
113118
:vartype log_files: azure.mgmt.postgresqlflexibleservers.aio.operations.LogFilesOperations
114119
:ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations
115120
:vartype server_threat_protection_settings:
116121
azure.mgmt.postgresqlflexibleservers.aio.operations.ServerThreatProtectionSettingsOperations
122+
:ivar tuning_options: TuningOptionsOperations operations
123+
:vartype tuning_options:
124+
azure.mgmt.postgresqlflexibleservers.aio.operations.TuningOptionsOperations
117125
:ivar virtual_endpoints: VirtualEndpointsOperations operations
118126
:vartype virtual_endpoints:
119127
azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations
@@ -126,8 +134,8 @@ class PostgreSQLManagementClient(
126134
:type subscription_id: str
127135
:param base_url: Service URL. Default value is "https://management.azure.com".
128136
:type base_url: str
129-
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
130-
default value may result in unsupported behavior.
137+
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
138+
this default value may result in unsupported behavior.
131139
:paramtype api_version: str
132140
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
133141
Retry-After header is present.
@@ -203,11 +211,13 @@ def __init__(
203211
self.private_link_resources = PrivateLinkResourcesOperations(
204212
self._client, self._config, self._serialize, self._deserialize
205213
)
214+
self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize)
206215
self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize)
207216
self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize)
208217
self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations(
209218
self._client, self._config, self._serialize, self._deserialize
210219
)
220+
self.tuning_options = TuningOptionsOperations(self._client, self._config, self._serialize, self._deserialize)
211221
self.virtual_endpoints = VirtualEndpointsOperations(
212222
self._client, self._config, self._serialize, self._deserialize
213223
)

sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
2626
from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations
2727
from ._private_link_resources_operations import PrivateLinkResourcesOperations
28+
from ._quota_usages_operations import QuotaUsagesOperations
2829
from ._replicas_operations import ReplicasOperations
2930
from ._log_files_operations import LogFilesOperations
3031
from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations
32+
from ._tuning_options_operations import TuningOptionsOperations
3133
from ._virtual_endpoints_operations import VirtualEndpointsOperations
3234
from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations
3335

@@ -55,9 +57,11 @@
5557
"PrivateEndpointConnectionsOperations",
5658
"PrivateEndpointConnectionOperations",
5759
"PrivateLinkResourcesOperations",
60+
"QuotaUsagesOperations",
5861
"ReplicasOperations",
5962
"LogFilesOperations",
6063
"ServerThreatProtectionSettingsOperations",
64+
"TuningOptionsOperations",
6165
"VirtualEndpointsOperations",
6266
"VirtualNetworkSubnetUsageOperations",
6367
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# pylint: disable=too-many-lines,too-many-statements
2+
# coding=utf-8
3+
# --------------------------------------------------------------------------
4+
# Copyright (c) Microsoft Corporation. All rights reserved.
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) AutoRest Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
8+
# --------------------------------------------------------------------------
9+
import sys
10+
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
11+
import urllib.parse
12+
13+
from azure.core.async_paging import AsyncItemPaged, AsyncList
14+
from azure.core.exceptions import (
15+
ClientAuthenticationError,
16+
HttpResponseError,
17+
ResourceExistsError,
18+
ResourceNotFoundError,
19+
ResourceNotModifiedError,
20+
map_error,
21+
)
22+
from azure.core.pipeline import PipelineResponse
23+
from azure.core.rest import AsyncHttpResponse, HttpRequest
24+
from azure.core.tracing.decorator import distributed_trace
25+
from azure.core.utils import case_insensitive_dict
26+
from azure.mgmt.core.exceptions import ARMErrorFormat
27+
28+
from ... import models as _models
29+
from ...operations._quota_usages_operations import build_list_request
30+
31+
if sys.version_info >= (3, 9):
32+
from collections.abc import MutableMapping
33+
else:
34+
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
35+
T = TypeVar("T")
36+
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
37+
38+
39+
class QuotaUsagesOperations:
40+
"""
41+
.. warning::
42+
**DO NOT** instantiate this class directly.
43+
44+
Instead, you should access the following operations through
45+
:class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s
46+
:attr:`quota_usages` attribute.
47+
"""
48+
49+
models = _models
50+
51+
def __init__(self, *args, **kwargs) -> None:
52+
input_args = list(args)
53+
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
54+
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
55+
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
56+
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
57+
58+
@distributed_trace
59+
def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.QuotaUsage"]:
60+
"""Get quota usages at specified location in a given subscription.
61+
62+
:param location_name: The name of the location. Required.
63+
:type location_name: str
64+
:return: An iterator like instance of either QuotaUsage or the result of cls(response)
65+
:rtype:
66+
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.QuotaUsage]
67+
:raises ~azure.core.exceptions.HttpResponseError:
68+
"""
69+
_headers = kwargs.pop("headers", {}) or {}
70+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
71+
72+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
73+
cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None)
74+
75+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
76+
401: ClientAuthenticationError,
77+
404: ResourceNotFoundError,
78+
409: ResourceExistsError,
79+
304: ResourceNotModifiedError,
80+
}
81+
error_map.update(kwargs.pop("error_map", {}) or {})
82+
83+
def prepare_request(next_link=None):
84+
if not next_link:
85+
86+
_request = build_list_request(
87+
location_name=location_name,
88+
subscription_id=self._config.subscription_id,
89+
api_version=api_version,
90+
headers=_headers,
91+
params=_params,
92+
)
93+
_request.url = self._client.format_url(_request.url)
94+
95+
else:
96+
# make call to next link with the client's api-version
97+
_parsed_next_link = urllib.parse.urlparse(next_link)
98+
_next_request_params = case_insensitive_dict(
99+
{
100+
key: [urllib.parse.quote(v) for v in value]
101+
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
102+
}
103+
)
104+
_next_request_params["api-version"] = self._config.api_version
105+
_request = HttpRequest(
106+
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
107+
)
108+
_request.url = self._client.format_url(_request.url)
109+
_request.method = "GET"
110+
return _request
111+
112+
async def extract_data(pipeline_response):
113+
deserialized = self._deserialize("QuotaUsagesListResult", pipeline_response)
114+
list_of_elem = deserialized.value
115+
if cls:
116+
list_of_elem = cls(list_of_elem) # type: ignore
117+
return deserialized.next_link or None, AsyncList(list_of_elem)
118+
119+
async def get_next(next_link=None):
120+
_request = prepare_request(next_link)
121+
122+
_stream = False
123+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
124+
_request, stream=_stream, **kwargs
125+
)
126+
response = pipeline_response.http_response
127+
128+
if response.status_code not in [200]:
129+
map_error(status_code=response.status_code, response=response, error_map=error_map)
130+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
131+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
132+
133+
return pipeline_response
134+
135+
return AsyncItemPaged(get_next, extract_data)

0 commit comments

Comments
 (0)