Skip to content
Closed
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
6 changes: 3 additions & 3 deletions sdk/rdbms/azure-mgmt-rdbms/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "87589a8b18e6dc791e0b49fadc74c5a513c5dd73",
"commit": "2353c808b334ddb01d52401b6815d2c36f06a95b",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.4.8",
"@autorest/modelerfour@4.24.3"
],
"autorest_command": "autorest specification/mysql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/mysql/resource-manager/readme.md"
"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/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/postgresql/resource-manager/readme.md"
}
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 = "10.2.0b7"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-03-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:
super(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-12-01")
api_version: str = kwargs.pop("api_version", "2023-03-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 @@ -25,8 +25,10 @@
FirewallRulesOperations,
GetPrivateDnsZoneSuffixOperations,
LocationBasedCapabilitiesOperations,
LogFilesOperations,
Operations,
ReplicasOperations,
ServerCapabilitiesOperations,
ServersOperations,
VirtualNetworkSubnetUsageOperations,
)
Expand All @@ -49,6 +51,9 @@ class PostgreSQLManagementClient: # pylint: disable=client-accepts-api-version-
:ivar location_based_capabilities: LocationBasedCapabilitiesOperations operations
:vartype location_based_capabilities:
azure.mgmt.rdbms.postgresql_flexibleservers.operations.LocationBasedCapabilitiesOperations
:ivar server_capabilities: ServerCapabilitiesOperations operations
:vartype server_capabilities:
azure.mgmt.rdbms.postgresql_flexibleservers.operations.ServerCapabilitiesOperations
:ivar check_name_availability: CheckNameAvailabilityOperations operations
:vartype check_name_availability:
azure.mgmt.rdbms.postgresql_flexibleservers.operations.CheckNameAvailabilityOperations
Expand All @@ -73,6 +78,8 @@ class PostgreSQLManagementClient: # pylint: disable=client-accepts-api-version-
azure.mgmt.rdbms.postgresql_flexibleservers.operations.GetPrivateDnsZoneSuffixOperations
:ivar replicas: ReplicasOperations operations
:vartype replicas: azure.mgmt.rdbms.postgresql_flexibleservers.operations.ReplicasOperations
:ivar log_files: LogFilesOperations operations
:vartype log_files: azure.mgmt.rdbms.postgresql_flexibleservers.operations.LogFilesOperations
:ivar virtual_network_subnet_usage: VirtualNetworkSubnetUsageOperations operations
:vartype virtual_network_subnet_usage:
azure.mgmt.rdbms.postgresql_flexibleservers.operations.VirtualNetworkSubnetUsageOperations
Expand All @@ -82,8 +89,8 @@ class PostgreSQLManagementClient: # pylint: disable=client-accepts-api-version-
: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 "2022-12-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-03-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 All @@ -110,6 +117,9 @@ def __init__(
self.location_based_capabilities = LocationBasedCapabilitiesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.server_capabilities = ServerCapabilitiesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.check_name_availability = CheckNameAvailabilityOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand All @@ -125,6 +135,7 @@ def __init__(
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.virtual_network_subnet_usage = VirtualNetworkSubnetUsageOperations(
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 = "10.2.0b7"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-03-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:
super(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-12-01")
api_version: str = kwargs.pop("api_version", "2023-03-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 @@ -25,8 +25,10 @@
FirewallRulesOperations,
GetPrivateDnsZoneSuffixOperations,
LocationBasedCapabilitiesOperations,
LogFilesOperations,
Operations,
ReplicasOperations,
ServerCapabilitiesOperations,
ServersOperations,
VirtualNetworkSubnetUsageOperations,
)
Expand All @@ -49,6 +51,9 @@ class PostgreSQLManagementClient: # pylint: disable=client-accepts-api-version-
:ivar location_based_capabilities: LocationBasedCapabilitiesOperations operations
:vartype location_based_capabilities:
azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.LocationBasedCapabilitiesOperations
:ivar server_capabilities: ServerCapabilitiesOperations operations
:vartype server_capabilities:
azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.ServerCapabilitiesOperations
:ivar check_name_availability: CheckNameAvailabilityOperations operations
:vartype check_name_availability:
azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.CheckNameAvailabilityOperations
Expand All @@ -75,6 +80,9 @@ class PostgreSQLManagementClient: # pylint: disable=client-accepts-api-version-
:ivar replicas: ReplicasOperations operations
:vartype replicas:
azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.ReplicasOperations
:ivar log_files: LogFilesOperations operations
:vartype log_files:
azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.LogFilesOperations
:ivar virtual_network_subnet_usage: VirtualNetworkSubnetUsageOperations operations
:vartype virtual_network_subnet_usage:
azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.VirtualNetworkSubnetUsageOperations
Expand All @@ -84,8 +92,8 @@ class PostgreSQLManagementClient: # pylint: disable=client-accepts-api-version-
: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 "2022-12-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-03-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 All @@ -112,6 +120,9 @@ def __init__(
self.location_based_capabilities = LocationBasedCapabilitiesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.server_capabilities = ServerCapabilitiesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.check_name_availability = CheckNameAvailabilityOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand All @@ -127,6 +138,7 @@ def __init__(
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.virtual_network_subnet_usage = VirtualNetworkSubnetUsageOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from ._administrators_operations import AdministratorsOperations
from ._backups_operations import BackupsOperations
from ._location_based_capabilities_operations import LocationBasedCapabilitiesOperations
from ._server_capabilities_operations import ServerCapabilitiesOperations
from ._check_name_availability_operations import CheckNameAvailabilityOperations
from ._check_name_availability_with_location_operations import CheckNameAvailabilityWithLocationOperations
from ._configurations_operations import ConfigurationsOperations
Expand All @@ -18,6 +19,7 @@
from ._operations import Operations
from ._get_private_dns_zone_suffix_operations import GetPrivateDnsZoneSuffixOperations
from ._replicas_operations import ReplicasOperations
from ._log_files_operations import LogFilesOperations
from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations

from ._patch import __all__ as _patch_all
Expand All @@ -28,6 +30,7 @@
"AdministratorsOperations",
"BackupsOperations",
"LocationBasedCapabilitiesOperations",
"ServerCapabilitiesOperations",
"CheckNameAvailabilityOperations",
"CheckNameAvailabilityWithLocationOperations",
"ConfigurationsOperations",
Expand All @@ -37,6 +40,7 @@
"Operations",
"GetPrivateDnsZoneSuffixOperations",
"ReplicasOperations",
"LogFilesOperations",
"VirtualNetworkSubnetUsageOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
Expand All @@ -21,7 +19,7 @@
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat

Expand Down Expand Up @@ -52,25 +50,17 @@ def __init__(self, *args, **kwargs) -> None:
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 execute(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.CapabilityProperties"]:
@distributed_trace_async
async def execute(self, location_name: str, **kwargs: Any) -> _models.CapabilitiesListResult:
"""Get capabilities at specified location in a given subscription.

:param location_name: The name of the location. Required.
:type location_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CapabilityProperties or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.CapabilityProperties]
:return: CapabilitiesListResult or the result of cls(response)
:rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.CapabilitiesListResult
: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.CapabilitiesListResult] = kwargs.pop("cls", None)

error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
Expand All @@ -79,62 +69,41 @@ def execute(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.C
}
error_map.update(kwargs.pop("error_map", {}) or {})

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

request = build_execute_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.execute.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
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 = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request

async def extract_data(pipeline_response):
deserialized = self._deserialize("CapabilitiesListResult", 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)
_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.CapabilitiesListResult] = kwargs.pop("cls", None)

request = build_execute_request(
location_name=location_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.execute.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_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)

deserialized = self._deserialize("CapabilitiesListResult", pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

execute.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities"
Expand Down
Loading