Skip to content

Commit

Permalink
CodeGen from PR 24995 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge f793b058c2df2fbd1033e16ef850b0fd04e143b1 into 81e979278deab6229a7b30a89dd83aac92234a3f
  • Loading branch information
SDKAuto committed Sep 11, 2023
1 parent be07e08 commit 815c942
Show file tree
Hide file tree
Showing 969 changed files with 27,503 additions and 22,032 deletions.
4 changes: 2 additions & 2 deletions sdk/sql/azure-mgmt-sql/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "3e3098d6b9302e166b611ce72b3392786d3ea0f7",
"commit": "a3dd6aab172d03a28d83560e5169a2c3d4e3975c",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/sql/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 --tag=package-composite-v5 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/sql/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/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
"readme": "specification/sql/resource-manager/readme.md"
}
6 changes: 6 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,23 @@ class SqlManagementClientConfiguration(Configuration): # pylint: disable=too-ma
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The subscription ID that identifies an Azure subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-05-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(SqlManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-05-01-preview")

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

self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-sql/{}".format(VERSION))
self._configure(**kwargs)
Expand Down
767 changes: 379 additions & 388 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py
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 = "4.0.0b12"
VERSION = "0.9.0"
6 changes: 6 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,23 @@ class SqlManagementClientConfiguration(Configuration): # pylint: disable=too-ma
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The subscription ID that identifies an Azure subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-05-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(SqlManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-05-01-preview")

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

self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-sql/{}".format(VERSION))
self._configure(**kwargs)
Expand Down
771 changes: 381 additions & 390 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py

Large diffs are not rendered by default.

320 changes: 158 additions & 162 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# --------------------------------------------------------------------------
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
Expand Down Expand Up @@ -60,6 +61,102 @@ 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 list_by_database(
self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any
) -> AsyncIterable["_models.BackupShortTermRetentionPolicy"]:
"""Gets a database's short term retention policy.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param server_name: The name of the server. Required.
:type server_name: str
:param database_name: The name of the database. Required.
:type database_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either BackupShortTermRetentionPolicy or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.BackupShortTermRetentionPolicy]
: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.BackupShortTermRetentionPolicyListResult] = kwargs.pop("cls", None)

error_map = {
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_by_database_request(
resource_group_name=resource_group_name,
server_name=server_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_database.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("BackupShortTermRetentionPolicyListResult", 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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(get_next, extract_data)

list_by_database.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies"
}

@distributed_trace_async
async def get(
self,
Expand Down Expand Up @@ -96,7 +193,7 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.BackupShortTermRetentionPolicy] = kwargs.pop("cls", None)

request = build_get_request(
Expand Down Expand Up @@ -155,7 +252,7 @@ async def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.BackupShortTermRetentionPolicy]] = kwargs.pop("cls", None)

Expand Down Expand Up @@ -338,7 +435,7 @@ async def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BackupShortTermRetentionPolicy] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
Expand Down Expand Up @@ -405,7 +502,7 @@ async def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.BackupShortTermRetentionPolicy]] = kwargs.pop("cls", None)

Expand Down Expand Up @@ -588,7 +685,7 @@ async def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.BackupShortTermRetentionPolicy] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
Expand Down Expand Up @@ -634,88 +731,3 @@ def get_long_running_output(pipeline_response):
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}"
}

@distributed_trace
def list_by_database(
self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any
) -> AsyncIterable["_models.BackupShortTermRetentionPolicy"]:
"""Gets a database's short term retention policy.
:param resource_group_name: The name of the resource group that contains the resource. You can
obtain this value from the Azure Resource Manager API or the portal. Required.
:type resource_group_name: str
:param server_name: The name of the server. Required.
:type server_name: str
:param database_name: The name of the database. Required.
:type database_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either BackupShortTermRetentionPolicy or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.BackupShortTermRetentionPolicy]
: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", "2021-02-01-preview"))
cls: ClsType[_models.BackupShortTermRetentionPolicyListResult] = kwargs.pop("cls", None)

error_map = {
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_by_database_request(
resource_group_name=resource_group_name,
server_name=server_name,
database_name=database_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_database.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

else:
request = HttpRequest("GET", next_link)
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("BackupShortTermRetentionPolicyListResult", 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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(get_next, extract_data)

list_by_database.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies"
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def list_by_location(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.LocationCapabilities] = kwargs.pop("cls", None)

request = build_list_by_location_request(
Expand Down
Loading

0 comments on commit 815c942

Please sign in to comment.