Skip to content

Commit

Permalink
[AutoRelease] t2-postgresqlflexibleservers-2024-10-30-49242(can only …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
3 people authored Nov 4, 2024
1 parent a1deb0d commit 7be2915
Show file tree
Hide file tree
Showing 141 changed files with 2,344 additions and 224 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Release History

## 1.1.0b1 (2024-11-04)

### Features Added

- Client `PostgreSQLManagementClient` added operation group `quota_usages`
- Client `PostgreSQLManagementClient` added operation group `tuning_options`
- Model `FlexibleServerCapability` added property `supported_features`
- Enum `IdentityType` added member `SYSTEM_ASSIGNED`
- Model `Server` added property `cluster`
- Model `ServerSkuCapability` added property `supported_features`
- Model `ServerSkuCapability` added property `security_profile`
- Enum `ServerVersion` added member `SEVENTEEN`
- Model `ServerVersionCapability` added property `supported_features`
- Enum `SourceType` added member `APSARA_DB_RDS`
- Enum `SourceType` added member `CRUNCHY_POSTGRE_SQL`
- Enum `SourceType` added member `DIGITAL_OCEAN_DROPLETS`
- Enum `SourceType` added member `DIGITAL_OCEAN_POSTGRE_SQL`
- Enum `SourceType` added member `EDB_ORACLE_SERVER`
- Enum `SourceType` added member `EDB_POSTGRE_SQL`
- Enum `SourceType` added member `HEROKU_POSTGRE_SQL`
- Enum `SourceType` added member `HUAWEI_COMPUTE`
- Enum `SourceType` added member `HUAWEI_RDS`
- Enum `SourceType` added member `POSTGRE_SQL_COSMOS_DB`
- Enum `SourceType` added member `POSTGRE_SQL_FLEXIBLE_SERVER`
- Enum `SourceType` added member `SUPABASE_POSTGRE_SQL`
- Enum `StorageType` added member `ULTRA_SSD_LRS`
- Added model `Cluster`
- Added model `ImpactRecord`
- Added model `IndexRecommendationDetails`
- Added model `IndexRecommendationListResult`
- Added model `IndexRecommendationResource`
- Added model `IndexRecommendationResourcePropertiesAnalyzedWorkload`
- Added model `IndexRecommendationResourcePropertiesImplementationDetails`
- Added model `NameProperty`
- Added model `QuotaUsage`
- Added model `QuotaUsagesListResult`
- Added enum `RecommendationType`
- Added enum `RecommendationTypeEnum`
- Added model `SupportedFeature`
- Added enum `SupportedFeatureStatusEnum`
- Added enum `TuningOptionEnum`
- Added model `TuningOptionsListResult`
- Added model `TuningOptionsResource`

## 1.0.0 (2024-10-11)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "9a8af2acfafc4d7a23eff41b859d2d332f51b0bc",
"commit": "8abf88fb9caa0bfea8d4026a4b7628bbe47961ed",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.10.2",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"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",
"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",
"readme": "specification/postgresql/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-insta
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

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

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
PrivateEndpointConnectionOperations,
PrivateEndpointConnectionsOperations,
PrivateLinkResourcesOperations,
QuotaUsagesOperations,
ReplicasOperations,
ServerCapabilitiesOperations,
ServerThreatProtectionSettingsOperations,
ServersOperations,
TuningOptionsOperations,
VirtualEndpointsOperations,
VirtualNetworkSubnetUsageOperations,
)
Expand Down Expand Up @@ -107,13 +109,18 @@ class PostgreSQLManagementClient(
:ivar private_link_resources: PrivateLinkResourcesOperations operations
:vartype private_link_resources:
azure.mgmt.postgresqlflexibleservers.operations.PrivateLinkResourcesOperations
:ivar quota_usages: QuotaUsagesOperations operations
:vartype quota_usages: azure.mgmt.postgresqlflexibleservers.operations.QuotaUsagesOperations
:ivar replicas: ReplicasOperations operations
:vartype replicas: azure.mgmt.postgresqlflexibleservers.operations.ReplicasOperations
:ivar log_files: LogFilesOperations operations
:vartype log_files: azure.mgmt.postgresqlflexibleservers.operations.LogFilesOperations
:ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations
:vartype server_threat_protection_settings:
azure.mgmt.postgresqlflexibleservers.operations.ServerThreatProtectionSettingsOperations
:ivar tuning_options: TuningOptionsOperations operations
:vartype tuning_options:
azure.mgmt.postgresqlflexibleservers.operations.TuningOptionsOperations
:ivar virtual_endpoints: VirtualEndpointsOperations operations
:vartype virtual_endpoints:
azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations
Expand All @@ -126,8 +133,8 @@ class PostgreSQLManagementClient(
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down Expand Up @@ -203,11 +210,13 @@ def __init__(
self.private_link_resources = PrivateLinkResourcesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize)
self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize)
self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize)
self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.tuning_options = TuningOptionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_endpoints = VirtualEndpointsOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0"
VERSION = "1.1.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-insta
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

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

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
PrivateEndpointConnectionOperations,
PrivateEndpointConnectionsOperations,
PrivateLinkResourcesOperations,
QuotaUsagesOperations,
ReplicasOperations,
ServerCapabilitiesOperations,
ServerThreatProtectionSettingsOperations,
ServersOperations,
TuningOptionsOperations,
VirtualEndpointsOperations,
VirtualNetworkSubnetUsageOperations,
)
Expand Down Expand Up @@ -107,13 +109,19 @@ class PostgreSQLManagementClient(
:ivar private_link_resources: PrivateLinkResourcesOperations operations
:vartype private_link_resources:
azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateLinkResourcesOperations
:ivar quota_usages: QuotaUsagesOperations operations
:vartype quota_usages:
azure.mgmt.postgresqlflexibleservers.aio.operations.QuotaUsagesOperations
:ivar replicas: ReplicasOperations operations
:vartype replicas: azure.mgmt.postgresqlflexibleservers.aio.operations.ReplicasOperations
:ivar log_files: LogFilesOperations operations
:vartype log_files: azure.mgmt.postgresqlflexibleservers.aio.operations.LogFilesOperations
:ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations
:vartype server_threat_protection_settings:
azure.mgmt.postgresqlflexibleservers.aio.operations.ServerThreatProtectionSettingsOperations
:ivar tuning_options: TuningOptionsOperations operations
:vartype tuning_options:
azure.mgmt.postgresqlflexibleservers.aio.operations.TuningOptionsOperations
:ivar virtual_endpoints: VirtualEndpointsOperations operations
:vartype virtual_endpoints:
azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations
Expand All @@ -126,8 +134,8 @@ class PostgreSQLManagementClient(
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down Expand Up @@ -203,11 +211,13 @@ def __init__(
self.private_link_resources = PrivateLinkResourcesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize)
self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize)
self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize)
self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.tuning_options = TuningOptionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_endpoints = VirtualEndpointsOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
from ._quota_usages_operations import QuotaUsagesOperations
from ._replicas_operations import ReplicasOperations
from ._log_files_operations import LogFilesOperations
from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations
from ._tuning_options_operations import TuningOptionsOperations
from ._virtual_endpoints_operations import VirtualEndpointsOperations
from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations

Expand Down Expand Up @@ -55,9 +57,11 @@
"PrivateEndpointConnectionsOperations",
"PrivateEndpointConnectionOperations",
"PrivateLinkResourcesOperations",
"QuotaUsagesOperations",
"ReplicasOperations",
"LogFilesOperations",
"ServerThreatProtectionSettingsOperations",
"TuningOptionsOperations",
"VirtualEndpointsOperations",
"VirtualNetworkSubnetUsageOperations",
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# pylint: disable=too-many-lines,too-many-statements
# 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.
# --------------------------------------------------------------------------
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models as _models
from ...operations._quota_usages_operations import build_list_request

if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]


class QuotaUsagesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s
:attr:`quota_usages` attribute.
"""

models = _models

def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace
def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.QuotaUsage"]:
"""Get quota usages at specified location in a given subscription.
:param location_name: The name of the location. Required.
:type location_name: str
:return: An iterator like instance of either QuotaUsage or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.QuotaUsage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None)

error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

def prepare_request(next_link=None):
if not next_link:

_request = build_list_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

async def extract_data(pipeline_response):
deserialized = self._deserialize("QuotaUsagesListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)

async def get_next(next_link=None):
_request = prepare_request(next_link)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(get_next, extract_data)
Loading

0 comments on commit 7be2915

Please sign in to comment.