diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/_meta.json b/sdk/iothub/azure-mgmt-iothubprovisioningservices/_meta.json index 1fb827bbaeab..ed5e5239b3c9 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/_meta.json +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "1134038a45bd1e65b1f6d77351b17df3617388f1", + "commit": "76532a48a1073f9556892e193d4d21bd10be3e37", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/deviceprovisioningservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/deviceprovisioningservices/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/deviceprovisioningservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_configuration.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_configuration.py index 56f64e498d4e..07618c70c8cc 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class IotDpsClientConfiguration(Configuration): +class IotDpsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IotDpsClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class IotDpsClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-02-05". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(IotDpsClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-10-15" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-iothubprovisioningservices/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_iot_dps_client.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_iot_dps_client.py index a628fc94cabc..edd317c24ccb 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_iot_dps_client.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_iot_dps_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import IotDpsClientConfiguration @@ -36,8 +37,11 @@ class IotDpsClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-02-05". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -63,7 +67,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_metadata.json b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_metadata.json index e993676a8c68..f391058c3d46 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2021-10-15", - "total_api_version_list": ["2021-10-15"], + "chosen_version": "2022-02-05", + "total_api_version_list": ["2022-02-05"], "client": { "name": "IotDpsClient", "filename": "_iot_dps_client", @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotDpsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotDpsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotDpsClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotDpsClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_version.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_version.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_configuration.py index 66c5084c7e5f..85fc441c66f2 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class IotDpsClientConfiguration(Configuration): +class IotDpsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IotDpsClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class IotDpsClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-02-05". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(IotDpsClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-10-15" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-iothubprovisioningservices/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_iot_dps_client.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_iot_dps_client.py index f82d1c38896d..cc89d141055c 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_iot_dps_client.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_iot_dps_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import IotDpsClientConfiguration @@ -36,8 +37,11 @@ class IotDpsClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-02-05". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_dps_certificate_operations.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_dps_certificate_operations.py index cc88345014b9..94bd6f1739b3 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_dps_certificate_operations.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_dps_certificate_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -63,7 +62,7 @@ async def get( :param provisioning_service_name: Name of the provisioning service the certificate is associated with. :type provisioning_service_name: str - :param if_match: ETag of the certificate. + :param if_match: ETag of the certificate. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateResponse, or the result of cls(response) @@ -76,19 +75,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_request( certificate_name=certificate_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, if_match=if_match, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +109,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async @@ -112,7 +118,7 @@ async def create_or_update( resource_group_name: str, provisioning_service_name: str, certificate_name: str, - certificate_description: "_models.CertificateBodyDescription", + certificate_description: "_models.CertificateResponse", if_match: Optional[str] = None, **kwargs: Any ) -> "_models.CertificateResponse": @@ -128,9 +134,9 @@ async def create_or_update( :type certificate_name: str :param certificate_description: The certificate body. :type certificate_description: - ~azure.mgmt.iothubprovisioningservices.models.CertificateBodyDescription + ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse :param if_match: ETag of the certificate. This is required to update an existing certificate, - and ignored while creating a brand new certificate. + and ignored while creating a brand new certificate. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateResponse, or the result of cls(response) @@ -143,15 +149,17 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') + _json = self._serialize.body(certificate_description, 'CertificateResponse') request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, certificate_name=certificate_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -160,7 +168,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,11 +187,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, if_match: str, @@ -209,22 +221,26 @@ async def delete( that the provisioning service will access by. :type certificate_name: str :param certificate_name1: This is optional, and it is the Common Name of the certificate. + Default value is None. :type certificate_name1: str - :param certificate_raw_bytes: Raw data within the certificate. + :param certificate_raw_bytes: Raw data within the certificate. Default value is None. :type certificate_raw_bytes: bytearray :param certificate_is_verified: Indicates if certificate has been verified by owner of the - private key. + private key. Default value is None. :type certificate_is_verified: bool - :param certificate_purpose: A description that mentions the purpose of the certificate. + :param certificate_purpose: A description that mentions the purpose of the certificate. Default + value is None. :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificate_created: Time the certificate is created. + :param certificate_created: Time the certificate is created. Default value is None. :type certificate_created: ~datetime.datetime - :param certificate_last_updated: Time the certificate is last updated. + :param certificate_last_updated: Time the certificate is last updated. Default value is None. :type certificate_last_updated: ~datetime.datetime :param certificate_has_private_key: Indicates if the certificate contains a private key. + Default value is None. :type certificate_has_private_key: bool - :param certificate_nonce: Random number generated to indicate Proof of Possession. + :param certificate_nonce: Random number generated to indicate Proof of Possession. Default + value is None. :type certificate_nonce: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -237,12 +253,15 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, certificate_name=certificate_name, + api_version=api_version, if_match=if_match, certificate_name1=certificate_name1, certificate_raw_bytes=certificate_raw_bytes, @@ -257,7 +276,11 @@ async def delete( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -268,7 +291,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async @@ -295,17 +318,24 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -320,7 +350,7 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates"} # type: ignore @distributed_trace_async @@ -352,23 +382,26 @@ async def generate_verification_code( :type resource_group_name: str :param provisioning_service_name: Name of provisioning service. :type provisioning_service_name: str - :param certificate_name1: Common Name for the certificate. + :param certificate_name1: Common Name for the certificate. Default value is None. :type certificate_name1: str - :param certificate_raw_bytes: Raw data of certificate. + :param certificate_raw_bytes: Raw data of certificate. Default value is None. :type certificate_raw_bytes: bytearray :param certificate_is_verified: Indicates if the certificate has been verified by owner of the - private key. + private key. Default value is None. :type certificate_is_verified: bool - :param certificate_purpose: Description mentioning the purpose of the certificate. + :param certificate_purpose: Description mentioning the purpose of the certificate. Default + value is None. :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificate_created: Certificate creation time. + :param certificate_created: Certificate creation time. Default value is None. :type certificate_created: ~datetime.datetime - :param certificate_last_updated: Certificate last updated time. + :param certificate_last_updated: Certificate last updated time. Default value is None. :type certificate_last_updated: ~datetime.datetime - :param certificate_has_private_key: Indicates if the certificate contains private key. + :param certificate_has_private_key: Indicates if the certificate contains private key. Default + value is None. :type certificate_has_private_key: bool - :param certificate_nonce: Random number generated to indicate Proof of Possession. + :param certificate_nonce: Random number generated to indicate Proof of Possession. Default + value is None. :type certificate_nonce: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VerificationCodeResponse, or the result of cls(response) @@ -381,12 +414,15 @@ async def generate_verification_code( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_generate_verification_code_request( certificate_name=certificate_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, if_match=if_match, certificate_name1=certificate_name1, certificate_raw_bytes=certificate_raw_bytes, @@ -401,7 +437,11 @@ async def generate_verification_code( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -416,7 +456,7 @@ async def generate_verification_code( return deserialized - generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + generate_verification_code.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore @distributed_trace_async @@ -453,23 +493,25 @@ async def verify_certificate( :type provisioning_service_name: str :param request: The name of the certificate. :type request: ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeRequest - :param certificate_name1: Common Name for the certificate. + :param certificate_name1: Common Name for the certificate. Default value is None. :type certificate_name1: str - :param certificate_raw_bytes: Raw data of certificate. + :param certificate_raw_bytes: Raw data of certificate. Default value is None. :type certificate_raw_bytes: bytearray :param certificate_is_verified: Indicates if the certificate has been verified by owner of the - private key. + private key. Default value is None. :type certificate_is_verified: bool - :param certificate_purpose: Describe the purpose of the certificate. + :param certificate_purpose: Describe the purpose of the certificate. Default value is None. :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificate_created: Certificate creation time. + :param certificate_created: Certificate creation time. Default value is None. :type certificate_created: ~datetime.datetime - :param certificate_last_updated: Certificate last updated time. + :param certificate_last_updated: Certificate last updated time. Default value is None. :type certificate_last_updated: ~datetime.datetime - :param certificate_has_private_key: Indicates if the certificate contains private key. + :param certificate_has_private_key: Indicates if the certificate contains private key. Default + value is None. :type certificate_has_private_key: bool - :param certificate_nonce: Random number generated to indicate Proof of Possession. + :param certificate_nonce: Random number generated to indicate Proof of Possession. Default + value is None. :type certificate_nonce: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateResponse, or the result of cls(response) @@ -482,6 +524,7 @@ async def verify_certificate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(request, 'VerificationCodeRequest') @@ -491,6 +534,7 @@ async def verify_certificate( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, content_type=content_type, if_match=if_match, json=_json, @@ -507,7 +551,11 @@ async def verify_certificate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -522,5 +570,5 @@ async def verify_certificate( return deserialized - verify_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify'} # type: ignore + verify_certificate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify"} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_iot_dps_resource_operations.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_iot_dps_resource_operations.py index 86225427c2de..1ebb9de324ab 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_iot_dps_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_iot_dps_resource_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -26,7 +25,7 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class IotDpsResourceOperations: +class IotDpsResourceOperations: # pylint: disable=too-many-public-methods """IotDpsResourceOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -74,17 +73,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_request( provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore async def _create_or_update_initial( @@ -115,6 +121,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(iot_dps_description, 'ProvisioningServiceDescription') @@ -123,6 +130,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -130,7 +138,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -148,7 +160,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace_async @@ -186,8 +198,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -199,6 +212,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, iot_dps_description=iot_dps_description, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -223,10 +237,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore async def _update_initial( self, @@ -241,6 +254,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(provisioning_service_tags, 'TagsResource') @@ -249,6 +263,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -256,7 +271,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,7 +289,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace_async @@ -307,8 +326,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -320,6 +340,7 @@ async def begin_update( resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, provisioning_service_tags=provisioning_service_tags, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -344,12 +365,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, provisioning_service_name: str, resource_group_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_delete_request_initial( provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204, 404]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, provisioning_service_name: str, resource_group_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( provisioning_service_name=provisioning_service_name, resource_group_name=resource_group_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace def list_by_subscription( @@ -463,6 +491,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -473,6 +503,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -482,6 +513,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -499,7 +531,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,7 +549,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices"} # type: ignore @distributed_trace def list_by_resource_group( @@ -532,6 +568,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -543,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -553,6 +592,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -570,7 +610,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,7 +628,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices"} # type: ignore @distributed_trace_async async def get_operation_result( @@ -607,7 +651,7 @@ async def get_operation_result( on. :type provisioning_service_name: str :param asyncinfo: Async header used to poll on the status of the operation, obtained while - creating the long running operation. + creating the long running operation. Default value is "true". :type asyncinfo: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult, or the result of cls(response) @@ -620,19 +664,26 @@ async def get_operation_result( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_operation_result_request( operation_id=operation_id, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, asyncinfo=asyncinfo, template_url=self.get_operation_result.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -647,7 +698,7 @@ async def get_operation_result( return deserialized - get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}'} # type: ignore + get_operation_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}"} # type: ignore @distributed_trace @@ -672,6 +723,8 @@ def list_valid_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotDpsSkuDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -684,6 +737,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_valid_skus.metadata['url'], ) request = _convert_request(request) @@ -695,6 +749,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -712,7 +767,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,7 +785,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus'} # type: ignore + list_valid_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus"} # type: ignore @distributed_trace_async async def check_provisioning_service_name_availability( @@ -753,12 +812,14 @@ async def check_provisioning_service_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(arguments, 'OperationInputs') request = build_check_provisioning_service_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_provisioning_service_name_availability.metadata['url'], @@ -766,7 +827,11 @@ async def check_provisioning_service_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -781,7 +846,7 @@ async def check_provisioning_service_name_availability( return deserialized - check_provisioning_service_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability'} # type: ignore + check_provisioning_service_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability"} # type: ignore @distributed_trace @@ -807,6 +872,8 @@ def list_keys( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -819,6 +886,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) @@ -830,6 +898,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -847,7 +916,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -861,7 +934,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys"} # type: ignore @distributed_trace_async async def list_keys_for_key_name( @@ -895,18 +968,25 @@ async def list_keys_for_key_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_keys_for_key_name_request( provisioning_service_name=provisioning_service_name, key_name=key_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_keys_for_key_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -921,7 +1001,7 @@ async def list_keys_for_key_name( return deserialized - list_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys'} # type: ignore + list_keys_for_key_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys"} # type: ignore @distributed_trace_async @@ -951,17 +1031,24 @@ async def list_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -976,7 +1063,7 @@ async def list_private_link_resources( return deserialized - list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources'} # type: ignore + list_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources"} # type: ignore @distributed_trace_async @@ -1009,18 +1096,25 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, group_id=group_id, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1035,7 +1129,7 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}"} # type: ignore @distributed_trace_async @@ -1065,17 +1159,24 @@ async def list_private_endpoint_connections( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_private_endpoint_connections_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1090,7 +1191,7 @@ async def list_private_endpoint_connections( return deserialized - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async @@ -1123,18 +1224,25 @@ async def get_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1149,7 +1257,7 @@ async def get_private_endpoint_connection( return deserialized - get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _create_or_update_private_endpoint_connection_initial( @@ -1166,6 +1274,7 @@ async def _create_or_update_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -1175,6 +1284,7 @@ async def _create_or_update_private_endpoint_connection_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_private_endpoint_connection_initial.metadata['url'], @@ -1182,7 +1292,11 @@ async def _create_or_update_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1200,7 +1314,7 @@ async def _create_or_update_private_endpoint_connection_initial( return deserialized - _create_or_update_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -1240,8 +1354,9 @@ async def begin_create_or_update_private_endpoint_connection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1254,6 +1369,7 @@ async def begin_create_or_update_private_endpoint_connection( resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1278,10 +1394,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_create_or_update_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_private_endpoint_connection_initial( self, @@ -1296,18 +1411,25 @@ async def _delete_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_delete_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -1315,18 +1437,23 @@ async def _delete_private_endpoint_connection_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -1362,7 +1489,8 @@ async def begin_delete_private_endpoint_connection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1374,6 +1502,7 @@ async def begin_delete_private_endpoint_connection( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1397,7 +1526,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_operations.py index fab2c7bf0e5f..cd3a6bb27f71 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -59,6 +57,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -68,6 +68,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -76,6 +77,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -93,7 +95,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Devices/operations"} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/__init__.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/__init__.py index 936fe672799d..f3cdc3689686 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/__init__.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/__init__.py @@ -12,7 +12,7 @@ from ._models_py3 import CertificateProperties from ._models_py3 import CertificateResponse from ._models_py3 import ErrorDetails -from ._models_py3 import ErrorMesssage +from ._models_py3 import ErrorMessage from ._models_py3 import GroupIdInformation from ._models_py3 import GroupIdInformationProperties from ._models_py3 import IotDpsPropertiesDescription @@ -64,7 +64,7 @@ 'CertificateProperties', 'CertificateResponse', 'ErrorDetails', - 'ErrorMesssage', + 'ErrorMessage', 'GroupIdInformation', 'GroupIdInformationProperties', 'IotDpsPropertiesDescription', diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models_py3.py index 22b9183ec996..725aa71767e2 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models_py3.py @@ -21,26 +21,26 @@ class AsyncOperationResult(msrest.serialization.Model): :ivar status: current status of a long running operation. :vartype status: str :ivar error: Error message containing code, description and details. - :vartype error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMesssage + :vartype error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMessage """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'ErrorMesssage'}, + 'error': {'key': 'error', 'type': 'ErrorMessage'}, } def __init__( self, *, status: Optional[str] = None, - error: Optional["ErrorMesssage"] = None, + error: Optional["ErrorMessage"] = None, **kwargs ): """ :keyword status: current status of a long running operation. :paramtype status: str :keyword error: Error message containing code, description and details. - :paramtype error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMesssage + :paramtype error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMessage """ super(AsyncOperationResult, self).__init__(**kwargs) self.status = status @@ -134,8 +134,6 @@ class CertificateProperties(msrest.serialization.Model): 'subject': {'readonly': True}, 'expiry': {'readonly': True}, 'thumbprint': {'readonly': True}, - 'is_verified': {'readonly': True}, - 'certificate': {'readonly': True}, 'created': {'readonly': True}, 'updated': {'readonly': True}, } @@ -152,16 +150,24 @@ class CertificateProperties(msrest.serialization.Model): def __init__( self, + *, + is_verified: Optional[bool] = None, + certificate: Optional[bytearray] = None, **kwargs ): """ + :keyword is_verified: Determines whether certificate has been verified. + :paramtype is_verified: bool + :keyword certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :paramtype certificate: bytearray """ super(CertificateProperties, self).__init__(**kwargs) self.subject = None self.expiry = None self.thumbprint = None - self.is_verified = None - self.certificate = None + self.is_verified = is_verified + self.certificate = certificate self.created = None self.updated = None @@ -263,7 +269,7 @@ def __init__( self.details = None -class ErrorMesssage(msrest.serialization.Model): +class ErrorMessage(msrest.serialization.Model): """Error response containing message and code. :ivar code: standard error code. @@ -296,7 +302,7 @@ def __init__( :keyword details: detailed summary of error. :paramtype details: str """ - super(ErrorMesssage, self).__init__(**kwargs) + super(ErrorMessage, self).__init__(**kwargs) self.code = code self.message = message self.details = details diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_dps_certificate_operations.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_dps_certificate_operations.py index 46ef3da4a6d6..f6f2af63eedf 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_dps_certificate_operations.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_dps_certificate_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -47,23 +48,23 @@ def build_get_request( "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -92,25 +93,25 @@ def build_create_or_update_request( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', max_length=256, min_length=0), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -134,10 +135,11 @@ def build_delete_request( certificate_nonce: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -145,38 +147,38 @@ def build_delete_request( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if certificate_name1 is not None: - query_parameters['certificate.name'] = _SERIALIZER.query("certificate_name1", certificate_name1, 'str') + _query_parameters['certificate.name'] = _SERIALIZER.query("certificate_name1", certificate_name1, 'str') if certificate_raw_bytes is not None: - query_parameters['certificate.rawBytes'] = _SERIALIZER.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + _query_parameters['certificate.rawBytes'] = _SERIALIZER.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') if certificate_is_verified is not None: - query_parameters['certificate.isVerified'] = _SERIALIZER.query("certificate_is_verified", certificate_is_verified, 'bool') + _query_parameters['certificate.isVerified'] = _SERIALIZER.query("certificate_is_verified", certificate_is_verified, 'bool') if certificate_purpose is not None: - query_parameters['certificate.purpose'] = _SERIALIZER.query("certificate_purpose", certificate_purpose, 'str') + _query_parameters['certificate.purpose'] = _SERIALIZER.query("certificate_purpose", certificate_purpose, 'str') if certificate_created is not None: - query_parameters['certificate.created'] = _SERIALIZER.query("certificate_created", certificate_created, 'iso-8601') + _query_parameters['certificate.created'] = _SERIALIZER.query("certificate_created", certificate_created, 'iso-8601') if certificate_last_updated is not None: - query_parameters['certificate.lastUpdated'] = _SERIALIZER.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + _query_parameters['certificate.lastUpdated'] = _SERIALIZER.query("certificate_last_updated", certificate_last_updated, 'iso-8601') if certificate_has_private_key is not None: - query_parameters['certificate.hasPrivateKey'] = _SERIALIZER.query("certificate_has_private_key", certificate_has_private_key, 'bool') + _query_parameters['certificate.hasPrivateKey'] = _SERIALIZER.query("certificate_has_private_key", certificate_has_private_key, 'bool') if certificate_nonce is not None: - query_parameters['certificate.nonce'] = _SERIALIZER.query("certificate_nonce", certificate_nonce, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['certificate.nonce'] = _SERIALIZER.query("certificate_nonce", certificate_nonce, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,31 +189,32 @@ def build_list_request( provisioning_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,10 +236,11 @@ def build_generate_verification_code_request( certificate_nonce: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode") # pylint: disable=line-too-long path_format_arguments = { "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -244,38 +248,38 @@ def build_generate_verification_code_request( "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if certificate_name1 is not None: - query_parameters['certificate.name'] = _SERIALIZER.query("certificate_name1", certificate_name1, 'str') + _query_parameters['certificate.name'] = _SERIALIZER.query("certificate_name1", certificate_name1, 'str') if certificate_raw_bytes is not None: - query_parameters['certificate.rawBytes'] = _SERIALIZER.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + _query_parameters['certificate.rawBytes'] = _SERIALIZER.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') if certificate_is_verified is not None: - query_parameters['certificate.isVerified'] = _SERIALIZER.query("certificate_is_verified", certificate_is_verified, 'bool') + _query_parameters['certificate.isVerified'] = _SERIALIZER.query("certificate_is_verified", certificate_is_verified, 'bool') if certificate_purpose is not None: - query_parameters['certificate.purpose'] = _SERIALIZER.query("certificate_purpose", certificate_purpose, 'str') + _query_parameters['certificate.purpose'] = _SERIALIZER.query("certificate_purpose", certificate_purpose, 'str') if certificate_created is not None: - query_parameters['certificate.created'] = _SERIALIZER.query("certificate_created", certificate_created, 'iso-8601') + _query_parameters['certificate.created'] = _SERIALIZER.query("certificate_created", certificate_created, 'iso-8601') if certificate_last_updated is not None: - query_parameters['certificate.lastUpdated'] = _SERIALIZER.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + _query_parameters['certificate.lastUpdated'] = _SERIALIZER.query("certificate_last_updated", certificate_last_updated, 'iso-8601') if certificate_has_private_key is not None: - query_parameters['certificate.hasPrivateKey'] = _SERIALIZER.query("certificate_has_private_key", certificate_has_private_key, 'bool') + _query_parameters['certificate.hasPrivateKey'] = _SERIALIZER.query("certificate_has_private_key", certificate_has_private_key, 'bool') if certificate_nonce is not None: - query_parameters['certificate.nonce'] = _SERIALIZER.query("certificate_nonce", certificate_nonce, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['certificate.nonce'] = _SERIALIZER.query("certificate_nonce", certificate_nonce, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -299,12 +303,12 @@ def build_verify_certificate_request( certificate_nonce: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify") # pylint: disable=line-too-long path_format_arguments = { "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -312,40 +316,40 @@ def build_verify_certificate_request( "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if certificate_name1 is not None: - query_parameters['certificate.name'] = _SERIALIZER.query("certificate_name1", certificate_name1, 'str') + _query_parameters['certificate.name'] = _SERIALIZER.query("certificate_name1", certificate_name1, 'str') if certificate_raw_bytes is not None: - query_parameters['certificate.rawBytes'] = _SERIALIZER.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + _query_parameters['certificate.rawBytes'] = _SERIALIZER.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') if certificate_is_verified is not None: - query_parameters['certificate.isVerified'] = _SERIALIZER.query("certificate_is_verified", certificate_is_verified, 'bool') + _query_parameters['certificate.isVerified'] = _SERIALIZER.query("certificate_is_verified", certificate_is_verified, 'bool') if certificate_purpose is not None: - query_parameters['certificate.purpose'] = _SERIALIZER.query("certificate_purpose", certificate_purpose, 'str') + _query_parameters['certificate.purpose'] = _SERIALIZER.query("certificate_purpose", certificate_purpose, 'str') if certificate_created is not None: - query_parameters['certificate.created'] = _SERIALIZER.query("certificate_created", certificate_created, 'iso-8601') + _query_parameters['certificate.created'] = _SERIALIZER.query("certificate_created", certificate_created, 'iso-8601') if certificate_last_updated is not None: - query_parameters['certificate.lastUpdated'] = _SERIALIZER.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + _query_parameters['certificate.lastUpdated'] = _SERIALIZER.query("certificate_last_updated", certificate_last_updated, 'iso-8601') if certificate_has_private_key is not None: - query_parameters['certificate.hasPrivateKey'] = _SERIALIZER.query("certificate_has_private_key", certificate_has_private_key, 'bool') + _query_parameters['certificate.hasPrivateKey'] = _SERIALIZER.query("certificate_has_private_key", certificate_has_private_key, 'bool') if certificate_nonce is not None: - query_parameters['certificate.nonce'] = _SERIALIZER.query("certificate_nonce", certificate_nonce, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['certificate.nonce'] = _SERIALIZER.query("certificate_nonce", certificate_nonce, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -391,7 +395,7 @@ def get( :param provisioning_service_name: Name of the provisioning service the certificate is associated with. :type provisioning_service_name: str - :param if_match: ETag of the certificate. + :param if_match: ETag of the certificate. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateResponse, or the result of cls(response) @@ -404,19 +408,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_request( certificate_name=certificate_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, if_match=if_match, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +442,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}"} # type: ignore @distributed_trace @@ -440,7 +451,7 @@ def create_or_update( resource_group_name: str, provisioning_service_name: str, certificate_name: str, - certificate_description: "_models.CertificateBodyDescription", + certificate_description: "_models.CertificateResponse", if_match: Optional[str] = None, **kwargs: Any ) -> "_models.CertificateResponse": @@ -456,9 +467,9 @@ def create_or_update( :type certificate_name: str :param certificate_description: The certificate body. :type certificate_description: - ~azure.mgmt.iothubprovisioningservices.models.CertificateBodyDescription + ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse :param if_match: ETag of the certificate. This is required to update an existing certificate, - and ignored while creating a brand new certificate. + and ignored while creating a brand new certificate. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateResponse, or the result of cls(response) @@ -471,15 +482,17 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(certificate_description, 'CertificateBodyDescription') + _json = self._serialize.body(certificate_description, 'CertificateResponse') request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, certificate_name=certificate_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -488,7 +501,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -503,11 +520,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, if_match: str, @@ -537,22 +554,26 @@ def delete( that the provisioning service will access by. :type certificate_name: str :param certificate_name1: This is optional, and it is the Common Name of the certificate. + Default value is None. :type certificate_name1: str - :param certificate_raw_bytes: Raw data within the certificate. + :param certificate_raw_bytes: Raw data within the certificate. Default value is None. :type certificate_raw_bytes: bytearray :param certificate_is_verified: Indicates if certificate has been verified by owner of the - private key. + private key. Default value is None. :type certificate_is_verified: bool - :param certificate_purpose: A description that mentions the purpose of the certificate. + :param certificate_purpose: A description that mentions the purpose of the certificate. Default + value is None. :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificate_created: Time the certificate is created. + :param certificate_created: Time the certificate is created. Default value is None. :type certificate_created: ~datetime.datetime - :param certificate_last_updated: Time the certificate is last updated. + :param certificate_last_updated: Time the certificate is last updated. Default value is None. :type certificate_last_updated: ~datetime.datetime :param certificate_has_private_key: Indicates if the certificate contains a private key. + Default value is None. :type certificate_has_private_key: bool - :param certificate_nonce: Random number generated to indicate Proof of Possession. + :param certificate_nonce: Random number generated to indicate Proof of Possession. Default + value is None. :type certificate_nonce: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -565,12 +586,15 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, certificate_name=certificate_name, + api_version=api_version, if_match=if_match, certificate_name1=certificate_name1, certificate_raw_bytes=certificate_raw_bytes, @@ -585,7 +609,11 @@ def delete( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -596,7 +624,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}"} # type: ignore @distributed_trace @@ -623,17 +651,24 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -648,7 +683,7 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates"} # type: ignore @distributed_trace @@ -680,23 +715,26 @@ def generate_verification_code( :type resource_group_name: str :param provisioning_service_name: Name of provisioning service. :type provisioning_service_name: str - :param certificate_name1: Common Name for the certificate. + :param certificate_name1: Common Name for the certificate. Default value is None. :type certificate_name1: str - :param certificate_raw_bytes: Raw data of certificate. + :param certificate_raw_bytes: Raw data of certificate. Default value is None. :type certificate_raw_bytes: bytearray :param certificate_is_verified: Indicates if the certificate has been verified by owner of the - private key. + private key. Default value is None. :type certificate_is_verified: bool - :param certificate_purpose: Description mentioning the purpose of the certificate. + :param certificate_purpose: Description mentioning the purpose of the certificate. Default + value is None. :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificate_created: Certificate creation time. + :param certificate_created: Certificate creation time. Default value is None. :type certificate_created: ~datetime.datetime - :param certificate_last_updated: Certificate last updated time. + :param certificate_last_updated: Certificate last updated time. Default value is None. :type certificate_last_updated: ~datetime.datetime - :param certificate_has_private_key: Indicates if the certificate contains private key. + :param certificate_has_private_key: Indicates if the certificate contains private key. Default + value is None. :type certificate_has_private_key: bool - :param certificate_nonce: Random number generated to indicate Proof of Possession. + :param certificate_nonce: Random number generated to indicate Proof of Possession. Default + value is None. :type certificate_nonce: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VerificationCodeResponse, or the result of cls(response) @@ -709,12 +747,15 @@ def generate_verification_code( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_generate_verification_code_request( certificate_name=certificate_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, if_match=if_match, certificate_name1=certificate_name1, certificate_raw_bytes=certificate_raw_bytes, @@ -729,7 +770,11 @@ def generate_verification_code( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -744,7 +789,7 @@ def generate_verification_code( return deserialized - generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + generate_verification_code.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode"} # type: ignore @distributed_trace @@ -781,23 +826,25 @@ def verify_certificate( :type provisioning_service_name: str :param request: The name of the certificate. :type request: ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeRequest - :param certificate_name1: Common Name for the certificate. + :param certificate_name1: Common Name for the certificate. Default value is None. :type certificate_name1: str - :param certificate_raw_bytes: Raw data of certificate. + :param certificate_raw_bytes: Raw data of certificate. Default value is None. :type certificate_raw_bytes: bytearray :param certificate_is_verified: Indicates if the certificate has been verified by owner of the - private key. + private key. Default value is None. :type certificate_is_verified: bool - :param certificate_purpose: Describe the purpose of the certificate. + :param certificate_purpose: Describe the purpose of the certificate. Default value is None. :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificate_created: Certificate creation time. + :param certificate_created: Certificate creation time. Default value is None. :type certificate_created: ~datetime.datetime - :param certificate_last_updated: Certificate last updated time. + :param certificate_last_updated: Certificate last updated time. Default value is None. :type certificate_last_updated: ~datetime.datetime - :param certificate_has_private_key: Indicates if the certificate contains private key. + :param certificate_has_private_key: Indicates if the certificate contains private key. Default + value is None. :type certificate_has_private_key: bool - :param certificate_nonce: Random number generated to indicate Proof of Possession. + :param certificate_nonce: Random number generated to indicate Proof of Possession. Default + value is None. :type certificate_nonce: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateResponse, or the result of cls(response) @@ -810,6 +857,7 @@ def verify_certificate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(request, 'VerificationCodeRequest') @@ -819,6 +867,7 @@ def verify_certificate( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, content_type=content_type, if_match=if_match, json=_json, @@ -835,7 +884,11 @@ def verify_certificate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -850,5 +903,5 @@ def verify_certificate( return deserialized - verify_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify'} # type: ignore + verify_certificate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify"} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_iot_dps_resource_operations.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_iot_dps_resource_operations.py index 49de021e3d5f..6126ce8c8a12 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_iot_dps_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_iot_dps_resource_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,31 +35,32 @@ def build_get_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") # pylint: disable=line-too-long path_format_arguments = { "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -73,35 +74,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -117,35 +118,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -158,31 +159,32 @@ def build_delete_request_initial( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") # pylint: disable=line-too-long path_format_arguments = { "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -191,29 +193,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -223,30 +226,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,10 +264,11 @@ def build_get_operation_result_request( asyncinfo: str = "true", **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -271,22 +276,22 @@ def build_get_operation_result_request( "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['asyncinfo'] = _SERIALIZER.query("asyncinfo", asyncinfo, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['asyncinfo'] = _SERIALIZER.query("asyncinfo", asyncinfo, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,31 +302,32 @@ def build_list_valid_skus_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus") # pylint: disable=line-too-long path_format_arguments = { "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -333,33 +339,33 @@ def build_check_provisioning_service_name_availability_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -372,31 +378,32 @@ def build_list_keys_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys") # pylint: disable=line-too-long path_format_arguments = { "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -408,10 +415,11 @@ def build_list_keys_for_key_name_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys") # pylint: disable=line-too-long path_format_arguments = { "provisioningServiceName": _SERIALIZER.url("provisioning_service_name", provisioning_service_name, 'str'), "keyName": _SERIALIZER.url("key_name", key_name, 'str'), @@ -419,21 +427,21 @@ def build_list_keys_for_key_name_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -444,31 +452,32 @@ def build_list_private_link_resources_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -480,10 +489,11 @@ def build_get_private_link_resources_request( group_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -491,21 +501,21 @@ def build_get_private_link_resources_request( "groupId": _SERIALIZER.url("group_id", group_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -516,31 +526,32 @@ def build_list_private_endpoint_connections_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -552,10 +563,11 @@ def build_get_private_endpoint_connection_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -563,21 +575,21 @@ def build_get_private_endpoint_connection_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -592,12 +604,12 @@ def build_create_or_update_private_endpoint_connection_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -605,23 +617,23 @@ def build_create_or_update_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -635,10 +647,11 @@ def build_delete_private_endpoint_connection_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -646,25 +659,25 @@ def build_delete_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class IotDpsResourceOperations(object): +class IotDpsResourceOperations(object): # pylint: disable=too-many-public-methods """IotDpsResourceOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -712,17 +725,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_request( provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -737,7 +757,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore def _create_or_update_initial( @@ -753,6 +773,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(iot_dps_description, 'ProvisioningServiceDescription') @@ -761,6 +782,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -768,7 +790,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -786,7 +812,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace @@ -824,8 +850,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -837,6 +864,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, iot_dps_description=iot_dps_description, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -861,10 +889,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore def _update_initial( self, @@ -879,6 +906,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(provisioning_service_tags, 'TagsResource') @@ -887,6 +915,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -894,7 +923,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -908,7 +941,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace @@ -945,8 +978,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -958,6 +992,7 @@ def begin_update( resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, provisioning_service_tags=provisioning_service_tags, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -982,12 +1017,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, provisioning_service_name: str, resource_group_name: str, @@ -999,17 +1033,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_delete_request_initial( provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204, 404]: @@ -1019,11 +1060,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, provisioning_service_name: str, resource_group_name: str, @@ -1049,7 +1090,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1060,6 +1102,7 @@ def begin_delete( raw_result = self._delete_initial( provisioning_service_name=provisioning_service_name, resource_group_name=resource_group_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1080,10 +1123,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"} # type: ignore @distributed_trace def list_by_subscription( @@ -1101,6 +1143,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1111,6 +1155,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -1120,6 +1165,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1137,7 +1183,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1151,7 +1201,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices"} # type: ignore @distributed_trace def list_by_resource_group( @@ -1170,6 +1220,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1181,6 +1233,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -1191,6 +1244,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1208,7 +1262,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1222,7 +1280,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices"} # type: ignore @distributed_trace def get_operation_result( @@ -1245,7 +1303,7 @@ def get_operation_result( on. :type provisioning_service_name: str :param asyncinfo: Async header used to poll on the status of the operation, obtained while - creating the long running operation. + creating the long running operation. Default value is "true". :type asyncinfo: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult, or the result of cls(response) @@ -1258,19 +1316,26 @@ def get_operation_result( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_operation_result_request( operation_id=operation_id, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, provisioning_service_name=provisioning_service_name, + api_version=api_version, asyncinfo=asyncinfo, template_url=self.get_operation_result.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1285,7 +1350,7 @@ def get_operation_result( return deserialized - get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}'} # type: ignore + get_operation_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}"} # type: ignore @distributed_trace @@ -1310,6 +1375,8 @@ def list_valid_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotDpsSkuDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1322,6 +1389,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_valid_skus.metadata['url'], ) request = _convert_request(request) @@ -1333,6 +1401,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1350,7 +1419,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1364,7 +1437,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus'} # type: ignore + list_valid_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus"} # type: ignore @distributed_trace def check_provisioning_service_name_availability( @@ -1391,12 +1464,14 @@ def check_provisioning_service_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(arguments, 'OperationInputs') request = build_check_provisioning_service_name_availability_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_provisioning_service_name_availability.metadata['url'], @@ -1404,7 +1479,11 @@ def check_provisioning_service_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1419,7 +1498,7 @@ def check_provisioning_service_name_availability( return deserialized - check_provisioning_service_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability'} # type: ignore + check_provisioning_service_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability"} # type: ignore @distributed_trace @@ -1445,6 +1524,8 @@ def list_keys( ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1457,6 +1538,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) @@ -1468,6 +1550,7 @@ def prepare_request(next_link=None): provisioning_service_name=provisioning_service_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1485,7 +1568,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1499,7 +1586,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys'} # type: ignore + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys"} # type: ignore @distributed_trace def list_keys_for_key_name( @@ -1533,18 +1620,25 @@ def list_keys_for_key_name( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_keys_for_key_name_request( provisioning_service_name=provisioning_service_name, key_name=key_name, subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_keys_for_key_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1559,7 +1653,7 @@ def list_keys_for_key_name( return deserialized - list_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys'} # type: ignore + list_keys_for_key_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys"} # type: ignore @distributed_trace @@ -1589,17 +1683,24 @@ def list_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1614,7 +1715,7 @@ def list_private_link_resources( return deserialized - list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources'} # type: ignore + list_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources"} # type: ignore @distributed_trace @@ -1647,18 +1748,25 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, group_id=group_id, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1673,7 +1781,7 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}"} # type: ignore @distributed_trace @@ -1703,17 +1811,24 @@ def list_private_endpoint_connections( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_list_private_endpoint_connections_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1728,7 +1843,7 @@ def list_private_endpoint_connections( return deserialized - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace @@ -1761,18 +1876,25 @@ def get_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_get_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1787,7 +1909,7 @@ def get_private_endpoint_connection( return deserialized - get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _create_or_update_private_endpoint_connection_initial( @@ -1804,6 +1926,7 @@ def _create_or_update_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -1813,6 +1936,7 @@ def _create_or_update_private_endpoint_connection_initial( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_private_endpoint_connection_initial.metadata['url'], @@ -1820,7 +1944,11 @@ def _create_or_update_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1838,7 +1966,7 @@ def _create_or_update_private_endpoint_connection_initial( return deserialized - _create_or_update_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -1878,8 +2006,9 @@ def begin_create_or_update_private_endpoint_connection( ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1892,6 +2021,7 @@ def begin_create_or_update_private_endpoint_connection( resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1916,10 +2046,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_create_or_update_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_private_endpoint_connection_initial( self, @@ -1934,18 +2063,25 @@ def _delete_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + request = build_delete_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -1953,18 +2089,23 @@ def _delete_private_endpoint_connection_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -2000,7 +2141,8 @@ def begin_delete_private_endpoint_connection( ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -2012,6 +2154,7 @@ def begin_delete_private_endpoint_connection( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2035,7 +2178,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_operations.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_operations.py index 41c645e0e4b8..5919b03865d8 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-15" + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Devices/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.Devices/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -85,6 +86,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-05") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -94,6 +97,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -102,6 +106,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -119,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,4 +142,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Devices/operations"} # type: ignore