diff --git a/sdk/maps/azure-mgmt-maps/_meta.json b/sdk/maps/azure-mgmt-maps/_meta.json index 5abd014b76ad..5cfe085890e5 100644 --- a/sdk/maps/azure-mgmt-maps/_meta.json +++ b/sdk/maps/azure-mgmt-maps/_meta.json @@ -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": "4139390cff1f11075509c99b5b044f3bdc194103", "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" } \ No newline at end of file diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_configuration.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_configuration.py index d5fcc9aba9ec..6c05b8b488d6 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_configuration.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_configuration.py @@ -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) diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_metadata.json b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_metadata.json index 7666e54fab3e..ad39ce1e4b0a 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_metadata.json +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_metadata.json @@ -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", diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_version.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_version.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/_version.py @@ -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" diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/_configuration.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/_configuration.py index 110554230d49..6e9c0662451b 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/_configuration.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/_configuration.py @@ -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) diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_accounts_operations.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_accounts_operations.py index 96064db1fe6f..b403b752e10b 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_accounts_operations.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_accounts_operations.py @@ -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. @@ -67,7 +67,7 @@ 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" @@ -75,7 +75,7 @@ async def create_or_update( 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) @@ -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. @@ -139,7 +139,7 @@ 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" @@ -147,7 +147,7 @@ async def update( 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) @@ -185,7 +185,7 @@ async def delete( self, resource_group_name: str, account_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a Maps Account. @@ -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) @@ -241,7 +241,7 @@ async def get( self, resource_group_name: str, account_name: str, - **kwargs + **kwargs: Any ) -> "_models.MapsAccount": """Get a Maps Account. @@ -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) @@ -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. @@ -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): @@ -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 @@ -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. @@ -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): @@ -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 @@ -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) @@ -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. @@ -521,7 +597,7 @@ 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" @@ -529,7 +605,7 @@ async def regenerate_keys( 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) diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_creators_operations.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_creators_operations.py index d4f43e80131a..4f6fc149ea0c 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_creators_operations.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_creators_operations.py @@ -45,7 +45,7 @@ def list_by_account( self, resource_group_name: str, account_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CreatorList"]: """Get all Creator instances for an Azure Maps Account. @@ -63,7 +63,7 @@ def list_by_account( 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): @@ -76,7 +76,7 @@ def prepare_request(next_link=None): url = self.list_by_account.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) @@ -122,7 +122,7 @@ async def create_or_update( account_name: str, creator_name: str, creator_resource: "_models.Creator", - **kwargs + **kwargs: Any ) -> "_models.Creator": """Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a custom set of mapping data. It requires an account to exist before it can be @@ -146,7 +146,7 @@ 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" @@ -154,7 +154,7 @@ async def create_or_update( 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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } @@ -199,7 +199,7 @@ async def update( account_name: str, creator_name: str, creator_update_parameters: "_models.CreatorUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.Creator": """Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. @@ -222,7 +222,7 @@ 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" @@ -230,7 +230,7 @@ async def update( 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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } @@ -270,7 +270,7 @@ async def delete( resource_group_name: str, account_name: str, creator_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a Maps Creator resource. @@ -290,14 +290,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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } @@ -330,7 +330,7 @@ async def get( resource_group_name: str, account_name: str, creator_name: str, - **kwargs + **kwargs: Any ) -> "_models.Creator": """Get a Maps Creator resource. @@ -350,14 +350,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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_maps_operations.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_maps_operations.py index 8800e9dbe965..762ea062e578 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_maps_operations.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/aio/operations/_maps_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_operations( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MapsOperations"]: """List operations available for the Maps Resource Provider. @@ -57,7 +57,7 @@ def list_operations( 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): @@ -103,3 +103,70 @@ async def get_next(next_link=None): get_next, extract_data ) list_operations.metadata = {'url': '/providers/Microsoft.Maps/operations'} # type: ignore + + def list_subscription_operations( + self, + **kwargs: Any + ) -> AsyncIterable["_models.MapsOperations"]: + """List operations available for the Maps Resource Provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MapsOperations or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.maps.models.MapsOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapsOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-12-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_subscription_operations.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MapsOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_subscription_operations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maps/operations'} # type: ignore diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/__init__.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/__init__.py index 987f1687d712..094261408b61 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/__init__.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/__init__.py @@ -7,6 +7,10 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AccountSasParameters + from ._models_py3 import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties + from ._models_py3 import CorsRule + from ._models_py3 import CorsRules from ._models_py3 import Creator from ._models_py3 import CreatorList from ._models_py3 import CreatorProperties @@ -15,9 +19,12 @@ from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse + from ._models_py3 import LinkedResource + from ._models_py3 import ManagedServiceIdentity from ._models_py3 import MapsAccount from ._models_py3 import MapsAccountKeys from ._models_py3 import MapsAccountProperties + from ._models_py3 import MapsAccountSasToken from ._models_py3 import MapsAccountUpdateParameters from ._models_py3 import MapsAccounts from ._models_py3 import MapsKeySpecification @@ -31,6 +38,10 @@ from ._models_py3 import SystemData from ._models_py3 import TrackedResource except (SyntaxError, ImportError): + from ._models import AccountSasParameters # type: ignore + from ._models import Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore + from ._models import CorsRule # type: ignore + from ._models import CorsRules # type: ignore from ._models import Creator # type: ignore from ._models import CreatorList # type: ignore from ._models import CreatorProperties # type: ignore @@ -39,9 +50,12 @@ from ._models import ErrorAdditionalInfo # type: ignore from ._models import ErrorDetail # type: ignore from ._models import ErrorResponse # type: ignore + from ._models import LinkedResource # type: ignore + from ._models import ManagedServiceIdentity # type: ignore from ._models import MapsAccount # type: ignore from ._models import MapsAccountKeys # type: ignore from ._models import MapsAccountProperties # type: ignore + from ._models import MapsAccountSasToken # type: ignore from ._models import MapsAccountUpdateParameters # type: ignore from ._models import MapsAccounts # type: ignore from ._models import MapsKeySpecification # type: ignore @@ -60,9 +74,15 @@ KeyType, Kind, Name, + ResourceIdentityType, + SigningKey, ) __all__ = [ + 'AccountSasParameters', + 'Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties', + 'CorsRule', + 'CorsRules', 'Creator', 'CreatorList', 'CreatorProperties', @@ -71,9 +91,12 @@ 'ErrorAdditionalInfo', 'ErrorDetail', 'ErrorResponse', + 'LinkedResource', + 'ManagedServiceIdentity', 'MapsAccount', 'MapsAccountKeys', 'MapsAccountProperties', + 'MapsAccountSasToken', 'MapsAccountUpdateParameters', 'MapsAccounts', 'MapsKeySpecification', @@ -90,4 +113,6 @@ 'KeyType', 'Kind', 'Name', + 'ResourceIdentityType', + 'SigningKey', ] diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_azure_maps_management_client_enums.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_azure_maps_management_client_enums.py index cbd8bf5f1d28..700a3a86df97 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_azure_maps_management_client_enums.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_azure_maps_management_client_enums.py @@ -56,3 +56,19 @@ class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): S0 = "S0" S1 = "S1" G2 = "G2" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class SigningKey(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The Map account key to use for signing. + """ + + PRIMARY_KEY = "primaryKey" + SECONDARY_KEY = "secondaryKey" diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models.py index 693213d7a0e0..536969dfc07f 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models.py @@ -10,6 +10,144 @@ import msrest.serialization +class AccountSasParameters(msrest.serialization.Model): + """Parameters used to create an account Shared Access Signature (SAS) token. The REST API access control is provided by Azure Maps Role Based Access (RBAC) identity and access. + + All required parameters must be populated in order to send to Azure. + + :param signing_key: Required. The Map account key to use for signing. Possible values include: + "primaryKey", "secondaryKey". + :type signing_key: str or ~azure.mgmt.maps.models.SigningKey + :param principal_id: Required. The principal Id also known as the object Id of a User Assigned + Managed Identity currently assigned to the Map Account. To assign a Managed Identity of the + account, use operation Create or Update an assign a User Assigned Identity resource Id. + :type principal_id: str + :param regions: Optional, allows control of which region locations are permitted access to + Azure Maps REST APIs with the SAS token. Example: "eastus", "westus2". Omitting this parameter + will allow all region locations to be accessible. + :type regions: list[str] + :param max_rate_per_second: Required. Required parameter which represents the desired maximum + request per second to allowed for the given SAS token. This does not guarantee perfect accuracy + in measurements but provides application safe guards of abuse with eventual enforcement. + :type max_rate_per_second: int + :param start: Required. The date time offset of when the token validity begins. For example + "2017-05-24T10:42:03.1567373Z". + :type start: str + :param expiry: Required. The date time offset of when the token validity expires. For example + "2017-05-24T10:42:03.1567373Z". + :type expiry: str + """ + + _validation = { + 'signing_key': {'required': True}, + 'principal_id': {'required': True}, + 'max_rate_per_second': {'required': True, 'maximum': 500, 'minimum_ex': 0}, + 'start': {'required': True}, + 'expiry': {'required': True}, + } + + _attribute_map = { + 'signing_key': {'key': 'signingKey', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'regions': {'key': 'regions', 'type': '[str]'}, + 'max_rate_per_second': {'key': 'maxRatePerSecond', 'type': 'int'}, + 'start': {'key': 'start', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountSasParameters, self).__init__(**kwargs) + self.signing_key = kwargs['signing_key'] + self.principal_id = kwargs['principal_id'] + self.regions = kwargs.get('regions', None) + self.max_rate_per_second = kwargs.get('max_rate_per_second', 500) + self.start = kwargs['start'] + self.expiry = kwargs['expiry'] + + +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CorsRule(msrest.serialization.Model): + """Specifies a CORS rule for the Map Account. + + All required parameters must be populated in order to send to Azure. + + :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :type allowed_origins: list[str] + """ + + _validation = { + 'allowed_origins': {'required': True}, + } + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(CorsRule, self).__init__(**kwargs) + self.allowed_origins = kwargs['allowed_origins'] + + +class CorsRules(msrest.serialization.Model): + """Sets the CORS rules. You can include up to five CorsRule elements in the request. + + :param cors_rules: The list of CORS rules. You can include up to five CorsRule elements in the + request. + :type cors_rules: list[~azure.mgmt.maps.models.CorsRule] + """ + + _validation = { + 'cors_rules': {'max_items': 5, 'min_items': 0}, + } + + _attribute_map = { + 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(CorsRules, self).__init__(**kwargs) + self.cors_rules = kwargs.get('cors_rules', None) + + class Resource(msrest.serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -113,6 +251,8 @@ class Creator(TrackedResource): :type location: str :param properties: Required. The Creator resource properties. :type properties: ~azure.mgmt.maps.models.CreatorProperties + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.maps.models.SystemData """ _validation = { @@ -121,6 +261,7 @@ class Creator(TrackedResource): 'type': {'readonly': True}, 'location': {'required': True}, 'properties': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -130,6 +271,7 @@ class Creator(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'CreatorProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -138,6 +280,7 @@ def __init__( ): super(Creator, self).__init__(**kwargs) self.properties = kwargs['properties'] + self.system_data = None class CreatorList(msrest.serialization.Model): @@ -250,11 +393,23 @@ class Dimension(msrest.serialization.Model): :type name: str :param display_name: Display name of dimension. :type display_name: str + :param internal_name: Internal name of the dimension. + :type internal_name: str + :param internal_metric_name: Internal metric name of the dimension. + :type internal_metric_name: str + :param source_mdm_namespace: Source Mdm Namespace of the dimension. + :type source_mdm_namespace: str + :param to_be_exported_to_shoebox: Flag to indicate exporting to Azure Monitor. + :type to_be_exported_to_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + 'to_be_exported_to_shoebox': {'key': 'toBeExportedToShoebox', 'type': 'bool'}, } def __init__( @@ -264,6 +419,10 @@ def __init__( super(Dimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) + self.internal_name = kwargs.get('internal_name', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) + self.to_be_exported_to_shoebox = kwargs.get('to_be_exported_to_shoebox', None) class ErrorAdditionalInfo(msrest.serialization.Model): @@ -274,7 +433,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: str + :vartype info: any """ _validation = { @@ -284,7 +443,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( @@ -360,6 +519,79 @@ def __init__( self.error = kwargs.get('error', None) +class LinkedResource(msrest.serialization.Model): + """Linked resource is reference to a resource deployed in an Azure subscription, add the linked resource ``uniqueName`` value as an optional parameter for operations on Azure Maps Geospatial REST APIs. + + All required parameters must be populated in order to send to Azure. + + :param unique_name: Required. A provided name which uniquely identifies the linked resource. + :type unique_name: str + :param id: Required. ARM resource id in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}'. + :type id: str + """ + + _validation = { + 'unique_name': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'unique_name': {'key': 'uniqueName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LinkedResource, self).__init__(**kwargs) + self.unique_name = kwargs['unique_name'] + self.id = kwargs['id'] + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.maps.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.maps.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + class MapsAccount(TrackedResource): """An Azure resource which represents access to a suite of Maps REST APIs. @@ -386,6 +618,8 @@ class MapsAccount(TrackedResource): :type kind: str or ~azure.mgmt.maps.models.Kind :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.maps.models.SystemData + :param identity: Sets the identity property for maps account. + :type identity: ~azure.mgmt.maps.models.ManagedServiceIdentity :param properties: The map account properties. :type properties: ~azure.mgmt.maps.models.MapsAccountProperties """ @@ -408,6 +642,7 @@ class MapsAccount(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'properties': {'key': 'properties', 'type': 'MapsAccountProperties'}, } @@ -419,6 +654,7 @@ def __init__( self.sku = kwargs['sku'] self.kind = kwargs.get('kind', "Gen1") self.system_data = None + self.identity = kwargs.get('identity', None) self.properties = kwargs.get('properties', None) @@ -472,19 +708,29 @@ class MapsAccountProperties(msrest.serialization.Model): :param disable_local_auth: Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will disable Shared Keys authentication from any usage. :type disable_local_auth: bool - :ivar provisioning_state: the state of the provisioning. + :ivar provisioning_state: The provisioning state of the Map account resource. :vartype provisioning_state: str + :param linked_resources: Sets the resources to be used for Managed Identities based operations + for the Map account resource. + :type linked_resources: list[~azure.mgmt.maps.models.LinkedResource] + :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :type cors: ~azure.mgmt.maps.models.CorsRules """ _validation = { 'unique_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'linked_resources': {'max_items': 10, 'min_items': 0}, } _attribute_map = { 'unique_id': {'key': 'uniqueId', 'type': 'str'}, 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'linked_resources': {'key': 'linkedResources', 'type': '[LinkedResource]'}, + 'cors': {'key': 'cors', 'type': 'CorsRules'}, } def __init__( @@ -495,6 +741,8 @@ def __init__( self.unique_id = None self.disable_local_auth = kwargs.get('disable_local_auth', False) self.provisioning_state = None + self.linked_resources = kwargs.get('linked_resources', None) + self.cors = kwargs.get('cors', None) class MapsAccounts(msrest.serialization.Model): @@ -527,6 +775,31 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class MapsAccountSasToken(msrest.serialization.Model): + """A new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed identity permissions on Azure (IAM) Role Based Access Control. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_sas_token: The shared access signature access token. + :vartype account_sas_token: str + """ + + _validation = { + 'account_sas_token': {'readonly': True}, + } + + _attribute_map = { + 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MapsAccountSasToken, self).__init__(**kwargs) + self.account_sas_token = None + + class MapsAccountUpdateParameters(msrest.serialization.Model): """Parameters used to update an existing Maps Account. @@ -542,27 +815,40 @@ class MapsAccountUpdateParameters(msrest.serialization.Model): :type kind: str or ~azure.mgmt.maps.models.Kind :param sku: The SKU of this account. :type sku: ~azure.mgmt.maps.models.Sku + :param identity: Sets the identity property for maps account. + :type identity: ~azure.mgmt.maps.models.ManagedServiceIdentity :ivar unique_id: A unique identifier for the maps account. :vartype unique_id: str :param disable_local_auth: Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will disable Shared Keys authentication from any usage. :type disable_local_auth: bool - :ivar provisioning_state: the state of the provisioning. + :ivar provisioning_state: The provisioning state of the Map account resource. :vartype provisioning_state: str + :param linked_resources: Sets the resources to be used for Managed Identities based operations + for the Map account resource. + :type linked_resources: list[~azure.mgmt.maps.models.LinkedResource] + :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :type cors: ~azure.mgmt.maps.models.CorsRules """ _validation = { 'unique_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'linked_resources': {'max_items': 10, 'min_items': 0}, } _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, 'kind': {'key': 'kind', 'type': 'str'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'linked_resources': {'key': 'properties.linkedResources', 'type': '[LinkedResource]'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, } def __init__( @@ -573,9 +859,12 @@ def __init__( self.tags = kwargs.get('tags', None) self.kind = kwargs.get('kind', "Gen1") self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) self.unique_id = None self.disable_local_auth = kwargs.get('disable_local_auth', False) self.provisioning_state = None + self.linked_resources = kwargs.get('linked_resources', None) + self.cors = kwargs.get('cors', None) class MapsKeySpecification(msrest.serialization.Model): @@ -655,6 +944,10 @@ class MetricSpecification(msrest.serialization.Model): :type category: str :param resource_id_dimension_name_override: Account Resource Id. :type resource_id_dimension_name_override: str + :param source_mdm_account: Source metrics account. + :type source_mdm_account: str + :param internal_metric_name: Internal metric name. + :type internal_metric_name: str """ _attribute_map = { @@ -667,6 +960,8 @@ class MetricSpecification(msrest.serialization.Model): 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'category': {'key': 'category', 'type': 'str'}, 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, } def __init__( @@ -683,6 +978,8 @@ def __init__( self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) self.category = kwargs.get('category', None) self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) + self.source_mdm_account = kwargs.get('source_mdm_account', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) class OperationDetail(msrest.serialization.Model): diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models_py3.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models_py3.py index ec9c52a1acaf..a3bbf73178e4 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models_py3.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models_py3.py @@ -15,6 +15,155 @@ from ._azure_maps_management_client_enums import * +class AccountSasParameters(msrest.serialization.Model): + """Parameters used to create an account Shared Access Signature (SAS) token. The REST API access control is provided by Azure Maps Role Based Access (RBAC) identity and access. + + All required parameters must be populated in order to send to Azure. + + :param signing_key: Required. The Map account key to use for signing. Possible values include: + "primaryKey", "secondaryKey". + :type signing_key: str or ~azure.mgmt.maps.models.SigningKey + :param principal_id: Required. The principal Id also known as the object Id of a User Assigned + Managed Identity currently assigned to the Map Account. To assign a Managed Identity of the + account, use operation Create or Update an assign a User Assigned Identity resource Id. + :type principal_id: str + :param regions: Optional, allows control of which region locations are permitted access to + Azure Maps REST APIs with the SAS token. Example: "eastus", "westus2". Omitting this parameter + will allow all region locations to be accessible. + :type regions: list[str] + :param max_rate_per_second: Required. Required parameter which represents the desired maximum + request per second to allowed for the given SAS token. This does not guarantee perfect accuracy + in measurements but provides application safe guards of abuse with eventual enforcement. + :type max_rate_per_second: int + :param start: Required. The date time offset of when the token validity begins. For example + "2017-05-24T10:42:03.1567373Z". + :type start: str + :param expiry: Required. The date time offset of when the token validity expires. For example + "2017-05-24T10:42:03.1567373Z". + :type expiry: str + """ + + _validation = { + 'signing_key': {'required': True}, + 'principal_id': {'required': True}, + 'max_rate_per_second': {'required': True, 'maximum': 500, 'minimum_ex': 0}, + 'start': {'required': True}, + 'expiry': {'required': True}, + } + + _attribute_map = { + 'signing_key': {'key': 'signingKey', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'regions': {'key': 'regions', 'type': '[str]'}, + 'max_rate_per_second': {'key': 'maxRatePerSecond', 'type': 'int'}, + 'start': {'key': 'start', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'str'}, + } + + def __init__( + self, + *, + signing_key: Union[str, "SigningKey"], + principal_id: str, + max_rate_per_second: int = 500, + start: str, + expiry: str, + regions: Optional[List[str]] = None, + **kwargs + ): + super(AccountSasParameters, self).__init__(**kwargs) + self.signing_key = signing_key + self.principal_id = principal_id + self.regions = regions + self.max_rate_per_second = max_rate_per_second + self.start = start + self.expiry = expiry + + +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CorsRule(msrest.serialization.Model): + """Specifies a CORS rule for the Map Account. + + All required parameters must be populated in order to send to Azure. + + :param allowed_origins: Required. Required if CorsRule element is present. A list of origin + domains that will be allowed via CORS, or "*" to allow all domains. + :type allowed_origins: list[str] + """ + + _validation = { + 'allowed_origins': {'required': True}, + } + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_origins: List[str], + **kwargs + ): + super(CorsRule, self).__init__(**kwargs) + self.allowed_origins = allowed_origins + + +class CorsRules(msrest.serialization.Model): + """Sets the CORS rules. You can include up to five CorsRule elements in the request. + + :param cors_rules: The list of CORS rules. You can include up to five CorsRule elements in the + request. + :type cors_rules: list[~azure.mgmt.maps.models.CorsRule] + """ + + _validation = { + 'cors_rules': {'max_items': 5, 'min_items': 0}, + } + + _attribute_map = { + 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, + } + + def __init__( + self, + *, + cors_rules: Optional[List["CorsRule"]] = None, + **kwargs + ): + super(CorsRules, self).__init__(**kwargs) + self.cors_rules = cors_rules + + class Resource(msrest.serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -121,6 +270,8 @@ class Creator(TrackedResource): :type location: str :param properties: Required. The Creator resource properties. :type properties: ~azure.mgmt.maps.models.CreatorProperties + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.maps.models.SystemData """ _validation = { @@ -129,6 +280,7 @@ class Creator(TrackedResource): 'type': {'readonly': True}, 'location': {'required': True}, 'properties': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -138,6 +290,7 @@ class Creator(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'CreatorProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -150,6 +303,7 @@ def __init__( ): super(Creator, self).__init__(tags=tags, location=location, **kwargs) self.properties = properties + self.system_data = None class CreatorList(msrest.serialization.Model): @@ -269,11 +423,23 @@ class Dimension(msrest.serialization.Model): :type name: str :param display_name: Display name of dimension. :type display_name: str + :param internal_name: Internal name of the dimension. + :type internal_name: str + :param internal_metric_name: Internal metric name of the dimension. + :type internal_metric_name: str + :param source_mdm_namespace: Source Mdm Namespace of the dimension. + :type source_mdm_namespace: str + :param to_be_exported_to_shoebox: Flag to indicate exporting to Azure Monitor. + :type to_be_exported_to_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + 'to_be_exported_to_shoebox': {'key': 'toBeExportedToShoebox', 'type': 'bool'}, } def __init__( @@ -281,11 +447,19 @@ def __init__( *, name: Optional[str] = None, display_name: Optional[str] = None, + internal_name: Optional[str] = None, + internal_metric_name: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + to_be_exported_to_shoebox: Optional[bool] = None, **kwargs ): super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name + self.internal_name = internal_name + self.internal_metric_name = internal_metric_name + self.source_mdm_namespace = source_mdm_namespace + self.to_be_exported_to_shoebox = to_be_exported_to_shoebox class ErrorAdditionalInfo(msrest.serialization.Model): @@ -296,7 +470,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: str + :vartype info: any """ _validation = { @@ -306,7 +480,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( @@ -384,6 +558,85 @@ def __init__( self.error = error +class LinkedResource(msrest.serialization.Model): + """Linked resource is reference to a resource deployed in an Azure subscription, add the linked resource ``uniqueName`` value as an optional parameter for operations on Azure Maps Geospatial REST APIs. + + All required parameters must be populated in order to send to Azure. + + :param unique_name: Required. A provided name which uniquely identifies the linked resource. + :type unique_name: str + :param id: Required. ARM resource id in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}'. + :type id: str + """ + + _validation = { + 'unique_name': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'unique_name': {'key': 'uniqueName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + unique_name: str, + id: str, + **kwargs + ): + super(LinkedResource, self).__init__(**kwargs) + self.unique_name = unique_name + self.id = id + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.maps.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.maps.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + class MapsAccount(TrackedResource): """An Azure resource which represents access to a suite of Maps REST APIs. @@ -410,6 +663,8 @@ class MapsAccount(TrackedResource): :type kind: str or ~azure.mgmt.maps.models.Kind :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.maps.models.SystemData + :param identity: Sets the identity property for maps account. + :type identity: ~azure.mgmt.maps.models.ManagedServiceIdentity :param properties: The map account properties. :type properties: ~azure.mgmt.maps.models.MapsAccountProperties """ @@ -432,6 +687,7 @@ class MapsAccount(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'properties': {'key': 'properties', 'type': 'MapsAccountProperties'}, } @@ -442,6 +698,7 @@ def __init__( sku: "Sku", tags: Optional[Dict[str, str]] = None, kind: Optional[Union[str, "Kind"]] = "Gen1", + identity: Optional["ManagedServiceIdentity"] = None, properties: Optional["MapsAccountProperties"] = None, **kwargs ): @@ -449,6 +706,7 @@ def __init__( self.sku = sku self.kind = kind self.system_data = None + self.identity = identity self.properties = properties @@ -502,31 +760,45 @@ class MapsAccountProperties(msrest.serialization.Model): :param disable_local_auth: Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will disable Shared Keys authentication from any usage. :type disable_local_auth: bool - :ivar provisioning_state: the state of the provisioning. + :ivar provisioning_state: The provisioning state of the Map account resource. :vartype provisioning_state: str + :param linked_resources: Sets the resources to be used for Managed Identities based operations + for the Map account resource. + :type linked_resources: list[~azure.mgmt.maps.models.LinkedResource] + :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :type cors: ~azure.mgmt.maps.models.CorsRules """ _validation = { 'unique_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'linked_resources': {'max_items': 10, 'min_items': 0}, } _attribute_map = { 'unique_id': {'key': 'uniqueId', 'type': 'str'}, 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'linked_resources': {'key': 'linkedResources', 'type': '[LinkedResource]'}, + 'cors': {'key': 'cors', 'type': 'CorsRules'}, } def __init__( self, *, disable_local_auth: Optional[bool] = False, + linked_resources: Optional[List["LinkedResource"]] = None, + cors: Optional["CorsRules"] = None, **kwargs ): super(MapsAccountProperties, self).__init__(**kwargs) self.unique_id = None self.disable_local_auth = disable_local_auth self.provisioning_state = None + self.linked_resources = linked_resources + self.cors = cors class MapsAccounts(msrest.serialization.Model): @@ -561,6 +833,31 @@ def __init__( self.next_link = next_link +class MapsAccountSasToken(msrest.serialization.Model): + """A new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed identity permissions on Azure (IAM) Role Based Access Control. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_sas_token: The shared access signature access token. + :vartype account_sas_token: str + """ + + _validation = { + 'account_sas_token': {'readonly': True}, + } + + _attribute_map = { + 'account_sas_token': {'key': 'accountSasToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MapsAccountSasToken, self).__init__(**kwargs) + self.account_sas_token = None + + class MapsAccountUpdateParameters(msrest.serialization.Model): """Parameters used to update an existing Maps Account. @@ -576,27 +873,40 @@ class MapsAccountUpdateParameters(msrest.serialization.Model): :type kind: str or ~azure.mgmt.maps.models.Kind :param sku: The SKU of this account. :type sku: ~azure.mgmt.maps.models.Sku + :param identity: Sets the identity property for maps account. + :type identity: ~azure.mgmt.maps.models.ManagedServiceIdentity :ivar unique_id: A unique identifier for the maps account. :vartype unique_id: str :param disable_local_auth: Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will disable Shared Keys authentication from any usage. :type disable_local_auth: bool - :ivar provisioning_state: the state of the provisioning. + :ivar provisioning_state: The provisioning state of the Map account resource. :vartype provisioning_state: str + :param linked_resources: Sets the resources to be used for Managed Identities based operations + for the Map account resource. + :type linked_resources: list[~azure.mgmt.maps.models.LinkedResource] + :param cors: Specifies CORS rules for the Blob service. You can include up to five CorsRule + elements in the request. If no CorsRule elements are included in the request body, all CORS + rules will be deleted, and CORS will be disabled for the Blob service. + :type cors: ~azure.mgmt.maps.models.CorsRules """ _validation = { 'unique_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'linked_resources': {'max_items': 10, 'min_items': 0}, } _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, 'kind': {'key': 'kind', 'type': 'str'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'linked_resources': {'key': 'properties.linkedResources', 'type': '[LinkedResource]'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, } def __init__( @@ -605,16 +915,22 @@ def __init__( tags: Optional[Dict[str, str]] = None, kind: Optional[Union[str, "Kind"]] = "Gen1", sku: Optional["Sku"] = None, + identity: Optional["ManagedServiceIdentity"] = None, disable_local_auth: Optional[bool] = False, + linked_resources: Optional[List["LinkedResource"]] = None, + cors: Optional["CorsRules"] = None, **kwargs ): super(MapsAccountUpdateParameters, self).__init__(**kwargs) self.tags = tags self.kind = kind self.sku = sku + self.identity = identity self.unique_id = None self.disable_local_auth = disable_local_auth self.provisioning_state = None + self.linked_resources = linked_resources + self.cors = cors class MapsKeySpecification(msrest.serialization.Model): @@ -698,6 +1014,10 @@ class MetricSpecification(msrest.serialization.Model): :type category: str :param resource_id_dimension_name_override: Account Resource Id. :type resource_id_dimension_name_override: str + :param source_mdm_account: Source metrics account. + :type source_mdm_account: str + :param internal_metric_name: Internal metric name. + :type internal_metric_name: str """ _attribute_map = { @@ -710,6 +1030,8 @@ class MetricSpecification(msrest.serialization.Model): 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'category': {'key': 'category', 'type': 'str'}, 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, + 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, } def __init__( @@ -724,6 +1046,8 @@ def __init__( fill_gap_with_zero: Optional[bool] = None, category: Optional[str] = None, resource_id_dimension_name_override: Optional[str] = None, + source_mdm_account: Optional[str] = None, + internal_metric_name: Optional[str] = None, **kwargs ): super(MetricSpecification, self).__init__(**kwargs) @@ -736,6 +1060,8 @@ def __init__( self.fill_gap_with_zero = fill_gap_with_zero self.category = category self.resource_id_dimension_name_override = resource_id_dimension_name_override + self.source_mdm_account = source_mdm_account + self.internal_metric_name = internal_metric_name class OperationDetail(msrest.serialization.Model): diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_accounts_operations.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_accounts_operations.py index 1884423c9463..649487d67c84 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_accounts_operations.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_accounts_operations.py @@ -72,7 +72,7 @@ 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" @@ -80,7 +80,7 @@ def create_or_update( 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) @@ -145,7 +145,7 @@ 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" @@ -153,7 +153,7 @@ def update( 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) @@ -210,14 +210,14 @@ 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) @@ -267,14 +267,14 @@ 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) @@ -324,7 +324,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): @@ -337,7 +337,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 @@ -393,7 +393,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): @@ -444,6 +444,83 @@ def get_next(next_link=None): ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maps/accounts'} # type: ignore + def list_sas( + self, + resource_group_name, # type: str + account_name, # type: str + maps_account_sas_parameters, # type: "_models.AccountSasParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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 = 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 + def list_keys( self, resource_group_name, # type: str @@ -469,14 +546,14 @@ 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) @@ -533,7 +610,7 @@ 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" @@ -541,7 +618,7 @@ def regenerate_keys( 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) diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_creators_operations.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_creators_operations.py index d755d7c72ccb..cb195ab27672 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_creators_operations.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_creators_operations.py @@ -68,7 +68,7 @@ def list_by_account( 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): @@ -81,7 +81,7 @@ def prepare_request(next_link=None): url = self.list_by_account.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) @@ -152,7 +152,7 @@ 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" @@ -160,7 +160,7 @@ def create_or_update( 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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } @@ -229,7 +229,7 @@ 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" @@ -237,7 +237,7 @@ def update( 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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } @@ -298,14 +298,14 @@ 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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } @@ -359,14 +359,14 @@ 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'), 'creatorName': self._serialize.url("creator_name", creator_name, 'str'), } diff --git a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_maps_operations.py b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_maps_operations.py index 3671d70f0bb0..1c472eafbc0f 100644 --- a/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_maps_operations.py +++ b/sdk/maps/azure-mgmt-maps/azure/mgmt/maps/operations/_maps_operations.py @@ -62,7 +62,7 @@ def list_operations( 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): @@ -108,3 +108,71 @@ def get_next(next_link=None): get_next, extract_data ) list_operations.metadata = {'url': '/providers/Microsoft.Maps/operations'} # type: ignore + + def list_subscription_operations( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MapsOperations"] + """List operations available for the Maps Resource Provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MapsOperations or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.maps.models.MapsOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapsOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-12-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_subscription_operations.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MapsOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_subscription_operations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Maps/operations'} # type: ignore