Skip to content

Commit

Permalink
CodeGen from PR 16949 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge ac1232040a8eb4793c2feda4edb3a2b363d93780 into 20adfe8
  • Loading branch information
SDKAuto committed Dec 3, 2021
1 parent e16d161 commit 7d95445
Show file tree
Hide file tree
Showing 15 changed files with 1,038 additions and 83 deletions.
11 changes: 7 additions & 4 deletions sdk/maps/azure-mgmt-maps/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"autorest": "3.3.0",
"use": "@autorest/python@5.6.6",
"commit": "5e6a5758c2bd7128984f131be88200cd4d2d1a17",
"autorest": "3.4.5",
"use": [
"@autorest/python@5.8.4",
"@autorest/modelerfour@4.19.2"
],
"commit": "e6c2df56cdfa57897d9f79e2d6db21916944fe2a",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/maps/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0",
"autorest_command": "autorest specification/maps/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5",
"readme": "specification/maps/resource-manager/readme.md"
}
2 changes: 1 addition & 1 deletion sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-02-01"
self.api_version = "2021-12-01-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-maps/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"chosen_version": "2021-02-01",
"total_api_version_list": ["2021-02-01"],
"chosen_version": "2021-12-01-preview",
"total_api_version_list": ["2021-12-01-preview"],
"client": {
"name": "AzureMapsManagementClient",
"filename": "_azure_maps_management_client",
Expand Down
2 changes: 1 addition & 1 deletion sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_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 = "2.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-02-01"
self.api_version = "2021-12-01-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-maps/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def create_or_update(
resource_group_name: str,
account_name: str,
maps_account: "_models.MapsAccount",
**kwargs
**kwargs: Any
) -> "_models.MapsAccount":
"""Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps
REST APIs.
Expand All @@ -67,15 +67,15 @@ async def create_or_update(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

# Construct URL
url = self.create_or_update.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down Expand Up @@ -118,7 +118,7 @@ async def update(
resource_group_name: str,
account_name: str,
maps_account_update_parameters: "_models.MapsAccountUpdateParameters",
**kwargs
**kwargs: Any
) -> "_models.MapsAccount":
"""Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as
Sku, Tags, Properties.
Expand All @@ -139,15 +139,15 @@ async def update(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

# Construct URL
url = self.update.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down Expand Up @@ -185,7 +185,7 @@ async def delete(
self,
resource_group_name: str,
account_name: str,
**kwargs
**kwargs: Any
) -> None:
"""Delete a Maps Account.
Expand All @@ -203,14 +203,14 @@ async def delete(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
accept = "application/json"

# Construct URL
url = self.delete.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down Expand Up @@ -241,7 +241,7 @@ async def get(
self,
resource_group_name: str,
account_name: str,
**kwargs
**kwargs: Any
) -> "_models.MapsAccount":
"""Get a Maps Account.
Expand All @@ -259,14 +259,14 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
accept = "application/json"

# Construct URL
url = self.get.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down Expand Up @@ -299,7 +299,7 @@ async def get(
def list_by_resource_group(
self,
resource_group_name: str,
**kwargs
**kwargs: Any
) -> AsyncIterable["_models.MapsAccounts"]:
"""Get all Maps Accounts in a Resource Group.
Expand All @@ -315,7 +315,7 @@ def list_by_resource_group(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
accept = "application/json"

def prepare_request(next_link=None):
Expand All @@ -328,7 +328,7 @@ def prepare_request(next_link=None):
url = self.list_by_resource_group.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
Expand Down Expand Up @@ -369,7 +369,7 @@ async def get_next(next_link=None):

def list_by_subscription(
self,
**kwargs
**kwargs: Any
) -> AsyncIterable["_models.MapsAccounts"]:
"""Get all Maps Accounts in a Subscription.
Expand All @@ -383,7 +383,7 @@ def list_by_subscription(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -434,11 +434,87 @@ async def get_next(next_link=None):
)
list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maps/accounts'} # type: ignore

async def list_sas(
self,
resource_group_name: str,
account_name: str,
maps_account_sas_parameters: "_models.AccountSasParameters",
**kwargs: Any
) -> "_models.MapsAccountSasToken":
"""Create and list an account shared access signature token. Use this SAS token for authentication
to Azure Maps REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token.
Prerequisites:
#. Create or have an existing User Assigned Managed Identity in the same Azure region as the
account.
#. Create or update an Azure Map account with the same Azure region as the User Assigned
Managed Identity is placed.
:param resource_group_name: The name of the resource group. The name is case insensitive.
:type resource_group_name: str
:param account_name: The name of the Maps Account.
:type account_name: str
:param maps_account_sas_parameters: The updated parameters for the Maps Account.
:type maps_account_sas_parameters: ~azure.mgmt.maps.models.AccountSasParameters
:keyword callable cls: A custom type or function that will be passed the direct response
:return: MapsAccountSasToken, or the result of cls(response)
:rtype: ~azure.mgmt.maps.models.MapsAccountSasToken
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.MapsAccountSasToken"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-12-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

# Construct URL
url = self.list_sas.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(maps_account_sas_parameters, 'AccountSasParameters')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('MapsAccountSasToken', pipeline_response)

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

return deserialized
list_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/listSas'} # type: ignore

async def list_keys(
self,
resource_group_name: str,
account_name: str,
**kwargs
**kwargs: Any
) -> "_models.MapsAccountKeys":
"""Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to
the Maps REST APIs. Only one key is needed at a time; two are given to provide seamless key
Expand All @@ -458,14 +534,14 @@ async def list_keys(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
accept = "application/json"

# Construct URL
url = self.list_keys.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down Expand Up @@ -500,7 +576,7 @@ async def regenerate_keys(
resource_group_name: str,
account_name: str,
key_specification: "_models.MapsKeySpecification",
**kwargs
**kwargs: Any
) -> "_models.MapsAccountKeys":
"""Regenerate either the primary or secondary key for use with the Maps APIs. The old key will
stop working immediately.
Expand All @@ -521,15 +597,15 @@ async def regenerate_keys(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-12-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

# Construct URL
url = self.regenerate_keys.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down
Loading

0 comments on commit 7d95445

Please sign in to comment.