diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/CHANGELOG.md b/sdk/iothub/azure-mgmt-iothubprovisioningservices/CHANGELOG.md index 66d6e2541bb4..ca44fc10c150 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/CHANGELOG.md +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/CHANGELOG.md @@ -1,5 +1,36 @@ # Release History +## 1.0.0b1 (2021-05-14) + +This is beta preview version. + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + + ## 0.2.0 (2018-04-17) **General Breaking changes** diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/MANIFEST.in b/sdk/iothub/azure-mgmt-iothubprovisioningservices/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/MANIFEST.in +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/_meta.json b/sdk/iothub/azure-mgmt-iothubprovisioningservices/_meta.json new file mode 100644 index 000000000000..a0296d99df0f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.4.2", + "use": "@autorest/python@5.6.6", + "commit": "51d02bcb2421ebf41e0380f0c1542b07badd01b3", + "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 --track2 --use=@autorest/python@5.6.6 --version=3.4.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/__init__.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/__init__.py index 908617c53e25..b5e3690011d6 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/__init__.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/__init__.py @@ -1,18 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from .iot_dps_client import IotDpsClient -from .version import VERSION - -__all__ = ['IotDpsClient'] +from ._iot_dps_client import IotDpsClient +from ._version import VERSION __version__ = VERSION +__all__ = ['IotDpsClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_configuration.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_configuration.py new file mode 100644 index 000000000000..405f264e3bbf --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class IotDpsClientConfiguration(Configuration): + """Configuration for IotDpsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotDpsClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothubprovisioningservices/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **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 new file mode 100644 index 000000000000..014d5efa2400 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_iot_dps_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import IotDpsClientConfiguration +from .operations import Operations +from .operations import DpsCertificateOperations +from .operations import IotDpsResourceOperations +from . import models + + +class IotDpsClient(object): + """API for using the Azure IoT Hub Device Provisioning Service features. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothubprovisioningservices.operations.Operations + :ivar dps_certificate: DpsCertificateOperations operations + :vartype dps_certificate: azure.mgmt.iothubprovisioningservices.operations.DpsCertificateOperations + :ivar iot_dps_resource: IotDpsResourceOperations operations + :vartype iot_dps_resource: azure.mgmt.iothubprovisioningservices.operations.IotDpsResourceOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotDpsClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.dps_certificate = DpsCertificateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_dps_resource = IotDpsResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> IotDpsClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_metadata.json b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_metadata.json new file mode 100644 index 000000000000..29371a3a47cf --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_metadata.json @@ -0,0 +1,105 @@ +{ + "chosen_version": "2020-03-01", + "total_api_version_list": ["2020-03-01"], + "client": { + "name": "IotDpsClient", + "filename": "_iot_dps_client", + "description": "API for using the Azure IoT Hub Device Provisioning Service features.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "dps_certificate": "DpsCertificateOperations", + "iot_dps_resource": "IotDpsResourceOperations" + } +} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/version.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_version.py similarity index 84% rename from sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/version.py rename to sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_version.py index 9bd1dfac7ecb..e5754a47ce68 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/version.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/_version.py @@ -1,13 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.2.0" - +VERSION = "1.0.0b1" diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/__init__.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/__init__.py new file mode 100644 index 000000000000..8e34e5ce2b5e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._iot_dps_client import IotDpsClient +__all__ = ['IotDpsClient'] 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 new file mode 100644 index 000000000000..369882d4724b --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class IotDpsClientConfiguration(Configuration): + """Configuration for IotDpsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotDpsClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothubprovisioningservices/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **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 new file mode 100644 index 000000000000..5fde1ad85d8f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/_iot_dps_client.py @@ -0,0 +1,92 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import IotDpsClientConfiguration +from .operations import Operations +from .operations import DpsCertificateOperations +from .operations import IotDpsResourceOperations +from .. import models + + +class IotDpsClient(object): + """API for using the Azure IoT Hub Device Provisioning Service features. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothubprovisioningservices.aio.operations.Operations + :ivar dps_certificate: DpsCertificateOperations operations + :vartype dps_certificate: azure.mgmt.iothubprovisioningservices.aio.operations.DpsCertificateOperations + :ivar iot_dps_resource: IotDpsResourceOperations operations + :vartype iot_dps_resource: azure.mgmt.iothubprovisioningservices.aio.operations.IotDpsResourceOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotDpsClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.dps_certificate = DpsCertificateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_dps_resource = IotDpsResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "IotDpsClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/__init__.py new file mode 100644 index 000000000000..6d426f86fd28 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._dps_certificate_operations import DpsCertificateOperations +from ._iot_dps_resource_operations import IotDpsResourceOperations + +__all__ = [ + 'Operations', + 'DpsCertificateOperations', + 'IotDpsResourceOperations', +] 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 new file mode 100644 index 000000000000..2cee209a1e2e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_dps_certificate_operations.py @@ -0,0 +1,587 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DpsCertificateOperations: + """DpsCertificateOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothubprovisioningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + certificate_name: str, + resource_group_name: str, + provisioning_service_name: str, + if_match: Optional[str] = None, + **kwargs + ) -> "_models.CertificateResponse": + """Get the certificate from the provisioning service. + + :param certificate_name: Name of the certificate to retrieve. + :type certificate_name: str + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :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. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + provisioning_service_name: str, + certificate_name: str, + certificate_description: "_models.CertificateBodyDescription", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.CertificateResponse": + """Upload the certificate to the provisioning service. + + Add new certificate or update an existing certificate. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: The name of the provisioning service. + :type provisioning_service_name: str + :param certificate_name: The name of the certificate create or update. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothubprovisioningservices.models.CertificateBodyDescription + :param if_match: ETag of the certificate. This is required to update an existing certificate, + and ignored while creating a brand new certificate. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=256, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + if_match: str, + provisioning_service_name: str, + certificate_name: str, + certificate_name1: Optional[str] = None, + certificate_raw_bytes: Optional[bytearray] = None, + certificate_is_verified: Optional[bool] = None, + certificate_purpose: Optional[Union[str, "_models.CertificatePurpose"]] = None, + certificate_created: Optional[datetime.datetime] = None, + certificate_last_updated: Optional[datetime.datetime] = None, + certificate_has_private_key: Optional[bool] = None, + certificate_nonce: Optional[str] = None, + **kwargs + ) -> None: + """Delete the Provisioning Service Certificate. + + Deletes the specified certificate associated with the Provisioning Service. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param if_match: ETag of the certificate. + :type if_match: str + :param provisioning_service_name: The name of the provisioning service. + :type provisioning_service_name: str + :param certificate_name: This is a mandatory field, and is the logical name of the certificate + 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. + :type certificate_name1: str + :param certificate_raw_bytes: Raw data within the certificate. + :type certificate_raw_bytes: bytearray + :param certificate_is_verified: Indicates if certificate has been verified by owner of the + private key. + :type certificate_is_verified: bool + :param certificate_purpose: A description that mentions the purpose of the certificate. + :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose + :param certificate_created: Time the certificate is created. + :type certificate_created: ~datetime.datetime + :param certificate_last_updated: Time the certificate is last updated. + :type certificate_last_updated: ~datetime.datetime + :param certificate_has_private_key: Indicates if the certificate contains a private key. + :type certificate_has_private_key: bool + :param certificate_nonce: Random number generated to indicate Proof of Possession. + :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) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if certificate_name1 is not None: + query_parameters['certificate.name'] = self._serialize.query("certificate_name1", certificate_name1, 'str') + if certificate_raw_bytes is not None: + query_parameters['certificate.rawBytes'] = self._serialize.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + if certificate_is_verified is not None: + query_parameters['certificate.isVerified'] = self._serialize.query("certificate_is_verified", certificate_is_verified, 'bool') + if certificate_purpose is not None: + query_parameters['certificate.purpose'] = self._serialize.query("certificate_purpose", certificate_purpose, 'str') + if certificate_created is not None: + query_parameters['certificate.created'] = self._serialize.query("certificate_created", certificate_created, 'iso-8601') + if certificate_last_updated is not None: + query_parameters['certificate.lastUpdated'] = self._serialize.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + if certificate_has_private_key is not None: + query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificate_has_private_key", certificate_has_private_key, 'bool') + if certificate_nonce is not None: + query_parameters['certificate.nonce'] = self._serialize.query("certificate_nonce", certificate_nonce, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + + async def list( + self, + resource_group_name: str, + provisioning_service_name: str, + **kwargs + ) -> "_models.CertificateListDescription": + """Get all the certificates tied to the provisioning service. + + :param resource_group_name: Name of resource group. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service to retrieve certificates for. + :type provisioning_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates'} # type: ignore + + async def generate_verification_code( + self, + certificate_name: str, + if_match: str, + resource_group_name: str, + provisioning_service_name: str, + certificate_name1: Optional[str] = None, + certificate_raw_bytes: Optional[bytearray] = None, + certificate_is_verified: Optional[bool] = None, + certificate_purpose: Optional[Union[str, "_models.CertificatePurpose"]] = None, + certificate_created: Optional[datetime.datetime] = None, + certificate_last_updated: Optional[datetime.datetime] = None, + certificate_has_private_key: Optional[bool] = None, + certificate_nonce: Optional[str] = None, + **kwargs + ) -> "_models.VerificationCodeResponse": + """Generate verification code for Proof of Possession. + + :param certificate_name: The mandatory logical name of the certificate, that the provisioning + service uses to access. + :type certificate_name: str + :param if_match: ETag of the certificate. This is required to update an existing certificate, + and ignored while creating a brand new certificate. + :type if_match: str + :param resource_group_name: name of resource group. + :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. + :type certificate_name1: str + :param certificate_raw_bytes: Raw data of certificate. + :type certificate_raw_bytes: bytearray + :param certificate_is_verified: Indicates if the certificate has been verified by owner of the + private key. + :type certificate_is_verified: bool + :param certificate_purpose: Description mentioning the purpose of the certificate. + :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose + :param certificate_created: Certificate creation time. + :type certificate_created: ~datetime.datetime + :param certificate_last_updated: Certificate last updated time. + :type certificate_last_updated: ~datetime.datetime + :param certificate_has_private_key: Indicates if the certificate contains private key. + :type certificate_has_private_key: bool + :param certificate_nonce: Random number generated to indicate Proof of Possession. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VerificationCodeResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if certificate_name1 is not None: + query_parameters['certificate.name'] = self._serialize.query("certificate_name1", certificate_name1, 'str') + if certificate_raw_bytes is not None: + query_parameters['certificate.rawBytes'] = self._serialize.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + if certificate_is_verified is not None: + query_parameters['certificate.isVerified'] = self._serialize.query("certificate_is_verified", certificate_is_verified, 'bool') + if certificate_purpose is not None: + query_parameters['certificate.purpose'] = self._serialize.query("certificate_purpose", certificate_purpose, 'str') + if certificate_created is not None: + query_parameters['certificate.created'] = self._serialize.query("certificate_created", certificate_created, 'iso-8601') + if certificate_last_updated is not None: + query_parameters['certificate.lastUpdated'] = self._serialize.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + if certificate_has_private_key is not None: + query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificate_has_private_key", certificate_has_private_key, 'bool') + if certificate_nonce is not None: + query_parameters['certificate.nonce'] = self._serialize.query("certificate_nonce", certificate_nonce, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VerificationCodeResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + async def verify_certificate( + self, + certificate_name: str, + if_match: str, + resource_group_name: str, + provisioning_service_name: str, + request: "_models.VerificationCodeRequest", + certificate_name1: Optional[str] = None, + certificate_raw_bytes: Optional[bytearray] = None, + certificate_is_verified: Optional[bool] = None, + certificate_purpose: Optional[Union[str, "_models.CertificatePurpose"]] = None, + certificate_created: Optional[datetime.datetime] = None, + certificate_last_updated: Optional[datetime.datetime] = None, + certificate_has_private_key: Optional[bool] = None, + certificate_nonce: Optional[str] = None, + **kwargs + ) -> "_models.CertificateResponse": + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param certificate_name: The mandatory logical name of the certificate, that the provisioning + service uses to access. + :type certificate_name: str + :param if_match: ETag of the certificate. + :type if_match: str + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param provisioning_service_name: Provisioning service name. + :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. + :type certificate_name1: str + :param certificate_raw_bytes: Raw data of certificate. + :type certificate_raw_bytes: bytearray + :param certificate_is_verified: Indicates if the certificate has been verified by owner of the + private key. + :type certificate_is_verified: bool + :param certificate_purpose: Describe the purpose of the certificate. + :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose + :param certificate_created: Certificate creation time. + :type certificate_created: ~datetime.datetime + :param certificate_last_updated: Certificate last updated time. + :type certificate_last_updated: ~datetime.datetime + :param certificate_has_private_key: Indicates if the certificate contains private key. + :type certificate_has_private_key: bool + :param certificate_nonce: Random number generated to indicate Proof of Possession. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if certificate_name1 is not None: + query_parameters['certificate.name'] = self._serialize.query("certificate_name1", certificate_name1, 'str') + if certificate_raw_bytes is not None: + query_parameters['certificate.rawBytes'] = self._serialize.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + if certificate_is_verified is not None: + query_parameters['certificate.isVerified'] = self._serialize.query("certificate_is_verified", certificate_is_verified, 'bool') + if certificate_purpose is not None: + query_parameters['certificate.purpose'] = self._serialize.query("certificate_purpose", certificate_purpose, 'str') + if certificate_created is not None: + query_parameters['certificate.created'] = self._serialize.query("certificate_created", certificate_created, 'iso-8601') + if certificate_last_updated is not None: + query_parameters['certificate.lastUpdated'] = self._serialize.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + if certificate_has_private_key is not None: + query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificate_has_private_key", certificate_has_private_key, 'bool') + if certificate_nonce is not None: + query_parameters['certificate.nonce'] = self._serialize.query("certificate_nonce", certificate_nonce, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'VerificationCodeRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..a9028e3ee10f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_iot_dps_resource_operations.py @@ -0,0 +1,1497 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotDpsResourceOperations: + """IotDpsResourceOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothubprovisioningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + provisioning_service_name: str, + resource_group_name: str, + **kwargs + ) -> "_models.ProvisioningServiceDescription": + """Get the non-security related metadata of the provisioning service. + + Get the metadata of the provisioning service without SAS keys. + + :param provisioning_service_name: Name of the provisioning service to retrieve. + :type provisioning_service_name: str + :param resource_group_name: Resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProvisioningServiceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + provisioning_service_name: str, + iot_dps_description: "_models.ProvisioningServiceDescription", + **kwargs + ) -> "_models.ProvisioningServiceDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_dps_description, 'ProvisioningServiceDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + provisioning_service_name: str, + iot_dps_description: "_models.ProvisioningServiceDescription", + **kwargs + ) -> AsyncLROPoller["_models.ProvisioningServiceDescription"]: + """Create or update the metadata of the provisioning service. + + Create or update the metadata of the provisioning service. The usual pattern to modify a + property is to retrieve the provisioning service metadata and security metadata, and then + combine them with the modified values in a new body to update the provisioning service. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service to create or update. + :type provisioning_service_name: str + :param iot_dps_description: Description of the provisioning service to create or update. + :type iot_dps_description: ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProvisioningServiceDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + provisioning_service_name=provisioning_service_name, + iot_dps_description=iot_dps_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + async def _update_initial( + self, + resource_group_name: str, + provisioning_service_name: str, + provisioning_service_tags: "_models.TagsResource", + **kwargs + ) -> "_models.ProvisioningServiceDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(provisioning_service_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + provisioning_service_name: str, + provisioning_service_tags: "_models.TagsResource", + **kwargs + ) -> AsyncLROPoller["_models.ProvisioningServiceDescription"]: + """Update an existing provisioning service's tags. + + Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate + method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service to create or update. + :type provisioning_service_name: str + :param provisioning_service_tags: Updated tag information to set into the provisioning service + instance. + :type provisioning_service_tags: ~azure.mgmt.iothubprovisioningservices.models.TagsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProvisioningServiceDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + provisioning_service_name=provisioning_service_name, + provisioning_service_tags=provisioning_service_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + async def _delete_initial( + self, + provisioning_service_name: str, + resource_group_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + async def begin_delete( + self, + provisioning_service_name: str, + resource_group_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete the Provisioning Service. + + Deletes the Provisioning Service. + + :param provisioning_service_name: Name of provisioning service to delete. + :type provisioning_service_name: str + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + provisioning_service_name=provisioning_service_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.ProvisioningServiceDescriptionListResult"]: + """Get all the provisioning services in a subscription. + + List all the provisioning services for a given subscription id. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProvisioningServiceDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.ProvisioningServiceDescriptionListResult"]: + """Get a list of all provisioning services in the given resource group. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProvisioningServiceDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + + async def get_operation_result( + self, + operation_id: str, + resource_group_name: str, + provisioning_service_name: str, + asyncinfo: str = "true", + **kwargs + ) -> "_models.AsyncOperationResult": + """Gets the status of a long running operation, such as create, update or delete a provisioning + service. + + :param operation_id: Operation id corresponding to long running operation. Use this to poll for + the status. + :type operation_id: str + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service that the operation is running + 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. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.AsyncOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get_operation_result.metadata['url'] # type: ignore + path_format_arguments = { + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['asyncinfo'] = self._serialize.query("asyncinfo", asyncinfo, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AsyncOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}'} # type: ignore + + def list_valid_skus( + self, + provisioning_service_name: str, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.IotDpsSkuDefinitionListResult"]: + """Get the list of valid SKUs for a provisioning service. + + Gets the list of valid SKUs and tiers for a provisioning service. + + :param provisioning_service_name: Name of provisioning service. + :type provisioning_service_name: str + :param resource_group_name: Name of resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotDpsSkuDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotDpsSkuDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotDpsSkuDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus'} # type: ignore + + async def check_provisioning_service_name_availability( + self, + arguments: "_models.OperationInputs", + **kwargs + ) -> "_models.NameAvailabilityInfo": + """Check if a provisioning service name is available. + + Check if a provisioning service name is available. This will validate if the name is + syntactically valid and if the name is usable. + + :param arguments: Set the name parameter in the OperationInputs structure to the name of the + provisioning service to check. + :type arguments: ~azure.mgmt.iothubprovisioningservices.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.NameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_provisioning_service_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(arguments, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_provisioning_service_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability'} # type: ignore + + def list_keys( + self, + provisioning_service_name: str, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: + """Get the security metadata for a provisioning service. + + List the primary and secondary keys for a provisioning service. + + :param provisioning_service_name: The provisioning service name to get the shared access keys + for. + :type provisioning_service_name: str + :param resource_group_name: resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys'} # type: ignore + + async def list_keys_for_key_name( + self, + provisioning_service_name: str, + key_name: str, + resource_group_name: str, + **kwargs + ) -> "_models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription": + """Get a shared access policy by name from a provisioning service. + + List primary and secondary keys for a specific key name. + + :param provisioning_service_name: Name of the provisioning service. + :type provisioning_service_name: str + :param key_name: Logical key name to get key-values for. + :type key_name: str + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRuleAccessRightsDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleAccessRightsDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys'} # type: ignore + + async def list_private_link_resources( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.PrivateLinkResources": + """List private link resources. + + List private link resources for the given provisioning service. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list_private_link_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources'} # type: ignore + + async def get_private_link_resources( + self, + resource_group_name: str, + resource_name: str, + group_id: str, + **kwargs + ) -> "_models.GroupIdInformation": + """Get the specified private link resource. + + Get the specified private link resource for the given provisioning service. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get_private_link_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}'} # type: ignore + + async def list_private_endpoint_connections( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> List["_models.PrivateEndpointConnection"]: + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list_private_endpoint_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections'} # type: ignore + + async def get_private_endpoint_connection( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get_private_endpoint_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_private_endpoint_connection_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_create_or_update_private_endpoint_connection( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Create or update private endpoint connection. + + Create or update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + async def _delete_private_endpoint_connection_initial( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_private_endpoint_connection_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete_private_endpoint_connection( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 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 new file mode 100644 index 000000000000..4c89d5acb537 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothubprovisioningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Microsoft.Devices REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore 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 deleted file mode 100644 index c5adb4f0be3e..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/iot_dps_client.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.service_client import ServiceClient -from msrest import Serializer, Deserializer -from msrestazure import AzureConfiguration -from .version import VERSION -from .operations.operations import Operations -from .operations.dps_certificate_operations import DpsCertificateOperations -from .operations.iot_dps_resource_operations import IotDpsResourceOperations -from . import models - - -class IotDpsClientConfiguration(AzureConfiguration): - """Configuration for IotDpsClient - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: The subscription identifier. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(IotDpsClientConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-mgmt-iothubprovisioningservices/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials - self.subscription_id = subscription_id - - -class IotDpsClient(object): - """API for using the Azure IoT Hub Device Provisioning Service features. - - :ivar config: Configuration for client. - :vartype config: IotDpsClientConfiguration - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothubprovisioningservices.operations.Operations - :ivar dps_certificate: DpsCertificate operations - :vartype dps_certificate: azure.mgmt.iothubprovisioningservices.operations.DpsCertificateOperations - :ivar iot_dps_resource: IotDpsResource operations - :vartype iot_dps_resource: azure.mgmt.iothubprovisioningservices.operations.IotDpsResourceOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: The subscription identifier. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = IotDpsClientConfiguration(credentials, subscription_id, base_url) - self._client = ServiceClient(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-01-22' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) - self.dps_certificate = DpsCertificateOperations( - self._client, self.config, self._serialize, self._deserialize) - self.iot_dps_resource = IotDpsResourceOperations( - self._client, self.config, self._serialize, self._deserialize) 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 6bfa525ee9ab..12e61b97212a 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 @@ -1,104 +1,138 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from .error_messsage_py3 import ErrorMesssage - from .async_operation_result_py3 import AsyncOperationResult - from .certificate_properties_py3 import CertificateProperties - from .certificate_response_py3 import CertificateResponse - from .certificate_list_description_py3 import CertificateListDescription - from .certificate_body_description_py3 import CertificateBodyDescription - from .iot_dps_sku_info_py3 import IotDpsSkuInfo - from .iot_hub_definition_description_py3 import IotHubDefinitionDescription - from .shared_access_signature_authorization_rule_access_rights_description_py3 import SharedAccessSignatureAuthorizationRuleAccessRightsDescription - from .iot_dps_properties_description_py3 import IotDpsPropertiesDescription - from .provisioning_service_description_py3 import ProvisioningServiceDescription - from .resource_py3 import Resource - from .operation_display_py3 import OperationDisplay - from .operation_py3 import Operation - from .error_details_py3 import ErrorDetails, ErrorDetailsException - from .iot_dps_sku_definition_py3 import IotDpsSkuDefinition - from .operation_inputs_py3 import OperationInputs - from .name_availability_info_py3 import NameAvailabilityInfo - from .tags_resource_py3 import TagsResource - from .verification_code_response_properties_py3 import VerificationCodeResponseProperties - from .verification_code_response_py3 import VerificationCodeResponse - from .verification_code_request_py3 import VerificationCodeRequest + from ._models_py3 import AsyncOperationResult + from ._models_py3 import CertificateBodyDescription + from ._models_py3 import CertificateListDescription + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificateResponse + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorMesssage + from ._models_py3 import GroupIdInformation + from ._models_py3 import GroupIdInformationProperties + from ._models_py3 import IotDpsPropertiesDescription + from ._models_py3 import IotDpsSkuDefinition + from ._models_py3 import IotDpsSkuDefinitionListResult + from ._models_py3 import IotDpsSkuInfo + from ._models_py3 import IotHubDefinitionDescription + from ._models_py3 import IpFilterRule + from ._models_py3 import NameAvailabilityInfo + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationInputs + from ._models_py3 import OperationListResult + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionProperties + from ._models_py3 import PrivateLinkResources + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import ProvisioningServiceDescription + from ._models_py3 import ProvisioningServiceDescriptionListResult + from ._models_py3 import Resource + from ._models_py3 import SharedAccessSignatureAuthorizationRuleAccessRightsDescription + from ._models_py3 import SharedAccessSignatureAuthorizationRuleListResult + from ._models_py3 import TagsResource + from ._models_py3 import VerificationCodeRequest + from ._models_py3 import VerificationCodeResponse + from ._models_py3 import VerificationCodeResponseProperties except (SyntaxError, ImportError): - from .error_messsage import ErrorMesssage - from .async_operation_result import AsyncOperationResult - from .certificate_properties import CertificateProperties - from .certificate_response import CertificateResponse - from .certificate_list_description import CertificateListDescription - from .certificate_body_description import CertificateBodyDescription - from .iot_dps_sku_info import IotDpsSkuInfo - from .iot_hub_definition_description import IotHubDefinitionDescription - from .shared_access_signature_authorization_rule_access_rights_description import SharedAccessSignatureAuthorizationRuleAccessRightsDescription - from .iot_dps_properties_description import IotDpsPropertiesDescription - from .provisioning_service_description import ProvisioningServiceDescription - from .resource import Resource - from .operation_display import OperationDisplay - from .operation import Operation - from .error_details import ErrorDetails, ErrorDetailsException - from .iot_dps_sku_definition import IotDpsSkuDefinition - from .operation_inputs import OperationInputs - from .name_availability_info import NameAvailabilityInfo - from .tags_resource import TagsResource - from .verification_code_response_properties import VerificationCodeResponseProperties - from .verification_code_response import VerificationCodeResponse - from .verification_code_request import VerificationCodeRequest -from .operation_paged import OperationPaged -from .provisioning_service_description_paged import ProvisioningServiceDescriptionPaged -from .iot_dps_sku_definition_paged import IotDpsSkuDefinitionPaged -from .shared_access_signature_authorization_rule_access_rights_description_paged import SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged -from .iot_dps_client_enums import ( - IotDpsSku, - State, - AllocationPolicy, + from ._models import AsyncOperationResult # type: ignore + from ._models import CertificateBodyDescription # type: ignore + from ._models import CertificateListDescription # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResponse # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import ErrorMesssage # type: ignore + from ._models import GroupIdInformation # type: ignore + from ._models import GroupIdInformationProperties # type: ignore + from ._models import IotDpsPropertiesDescription # type: ignore + from ._models import IotDpsSkuDefinition # type: ignore + from ._models import IotDpsSkuDefinitionListResult # type: ignore + from ._models import IotDpsSkuInfo # type: ignore + from ._models import IotHubDefinitionDescription # type: ignore + from ._models import IpFilterRule # type: ignore + from ._models import NameAvailabilityInfo # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationInputs # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionProperties # type: ignore + from ._models import PrivateLinkResources # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import ProvisioningServiceDescription # type: ignore + from ._models import ProvisioningServiceDescriptionListResult # type: ignore + from ._models import Resource # type: ignore + from ._models import SharedAccessSignatureAuthorizationRuleAccessRightsDescription # type: ignore + from ._models import SharedAccessSignatureAuthorizationRuleListResult # type: ignore + from ._models import TagsResource # type: ignore + from ._models import VerificationCodeRequest # type: ignore + from ._models import VerificationCodeResponse # type: ignore + from ._models import VerificationCodeResponseProperties # type: ignore + +from ._iot_dps_client_enums import ( AccessRightsDescription, - NameUnavailabilityReason, + AllocationPolicy, CertificatePurpose, + IotDpsSku, + IpFilterActionType, + IpFilterTargetType, + NameUnavailabilityReason, + PrivateLinkServiceConnectionStatus, + PublicNetworkAccess, + State, ) __all__ = [ - 'ErrorMesssage', 'AsyncOperationResult', + 'CertificateBodyDescription', + 'CertificateListDescription', 'CertificateProperties', 'CertificateResponse', - 'CertificateListDescription', - 'CertificateBodyDescription', + 'ErrorDetails', + 'ErrorMesssage', + 'GroupIdInformation', + 'GroupIdInformationProperties', + 'IotDpsPropertiesDescription', + 'IotDpsSkuDefinition', + 'IotDpsSkuDefinitionListResult', 'IotDpsSkuInfo', 'IotHubDefinitionDescription', - 'SharedAccessSignatureAuthorizationRuleAccessRightsDescription', - 'IotDpsPropertiesDescription', - 'ProvisioningServiceDescription', - 'Resource', - 'OperationDisplay', + 'IpFilterRule', + 'NameAvailabilityInfo', 'Operation', - 'ErrorDetails', 'ErrorDetailsException', - 'IotDpsSkuDefinition', + 'OperationDisplay', 'OperationInputs', - 'NameAvailabilityInfo', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionProperties', + 'PrivateLinkResources', + 'PrivateLinkServiceConnectionState', + 'ProvisioningServiceDescription', + 'ProvisioningServiceDescriptionListResult', + 'Resource', + 'SharedAccessSignatureAuthorizationRuleAccessRightsDescription', + 'SharedAccessSignatureAuthorizationRuleListResult', 'TagsResource', - 'VerificationCodeResponseProperties', - 'VerificationCodeResponse', 'VerificationCodeRequest', - 'OperationPaged', - 'ProvisioningServiceDescriptionPaged', - 'IotDpsSkuDefinitionPaged', - 'SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged', - 'IotDpsSku', - 'State', - 'AllocationPolicy', + 'VerificationCodeResponse', + 'VerificationCodeResponseProperties', 'AccessRightsDescription', - 'NameUnavailabilityReason', + 'AllocationPolicy', 'CertificatePurpose', + 'IotDpsSku', + 'IpFilterActionType', + 'IpFilterTargetType', + 'NameUnavailabilityReason', + 'PrivateLinkServiceConnectionStatus', + 'PublicNetworkAccess', + 'State', ] diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_iot_dps_client_enums.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_iot_dps_client_enums.py new file mode 100644 index 000000000000..474e215eeb84 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_iot_dps_client_enums.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRightsDescription(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rights that this key has. + """ + + SERVICE_CONFIG = "ServiceConfig" + ENROLLMENT_READ = "EnrollmentRead" + ENROLLMENT_WRITE = "EnrollmentWrite" + DEVICE_CONNECT = "DeviceConnect" + REGISTRATION_STATUS_READ = "RegistrationStatusRead" + REGISTRATION_STATUS_WRITE = "RegistrationStatusWrite" + +class AllocationPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Allocation policy to be used by this provisioning service. + """ + + HASHED = "Hashed" + GEO_LATENCY = "GeoLatency" + STATIC = "Static" + +class CertificatePurpose(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + CLIENT_AUTHENTICATION = "clientAuthentication" + SERVER_AUTHENTICATION = "serverAuthentication" + +class IotDpsSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Sku name. + """ + + S1 = "S1" + +class IpFilterActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The desired action for requests captured by this rule. + """ + + ACCEPT = "Accept" + REJECT = "Reject" + +class IpFilterTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Target for requests captured by this rule. + """ + + ALL = "all" + SERVICE_API = "serviceApi" + DEVICE_API = "deviceApi" + +class NameUnavailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """specifies the reason a name is unavailable + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of a private endpoint connection + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether requests from Public Network are allowed + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current state of the provisioning service. + """ + + ACTIVATING = "Activating" + ACTIVE = "Active" + DELETING = "Deleting" + DELETED = "Deleted" + ACTIVATION_FAILED = "ActivationFailed" + DELETION_FAILED = "DeletionFailed" + TRANSITIONING = "Transitioning" + SUSPENDING = "Suspending" + SUSPENDED = "Suspended" + RESUMING = "Resuming" + FAILING_OVER = "FailingOver" + FAILOVER_FAILED = "FailoverFailed" diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models.py new file mode 100644 index 000000000000..2a870e44bb9c --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models.py @@ -0,0 +1,1186 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AsyncOperationResult(msrest.serialization.Model): + """Result of a long running operation. + + :param status: current status of a long running operation. + :type status: str + :param error: Error message containing code, description and details. + :type error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMesssage + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorMesssage'}, + } + + def __init__( + self, + **kwargs + ): + super(AsyncOperationResult, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: Base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.CertificateResponse] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateResponse]'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :vartype certificate: bytearray + :ivar created: The certificate's creation date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'certificate': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'certificate': {'key': 'certificate', 'type': 'bytearray'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.certificate = None + self.created = None + self.updated = None + + +class CertificateResponse(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: properties of a certificate. + :type properties: ~azure.mgmt.iothubprovisioningservices.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateResponse, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class ErrorMesssage(msrest.serialization.Model): + """Error response containing message and code. + + :param code: standard error code. + :type code: str + :param message: standard error description. + :type message: str + :param details: detailed summary of error. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorMesssage, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on a provisioning service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothubprovisioningservices.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class IotDpsPropertiesDescription(msrest.serialization.Model): + """the service specific properties of a provisioning service, including keys, linked iot hubs, current state, and system generated properties such as hostname and idScope. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param state: Current state of the provisioning service. Possible values include: "Activating", + "Active", "Deleting", "Deleted", "ActivationFailed", "DeletionFailed", "Transitioning", + "Suspending", "Suspended", "Resuming", "FailingOver", "FailoverFailed". + :type state: str or ~azure.mgmt.iothubprovisioningservices.models.State + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.iothubprovisioningservices.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothubprovisioningservices.models.IpFilterRule] + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :param provisioning_state: The ARM provisioning state of the provisioning service. + :type provisioning_state: str + :param iot_hubs: List of IoT hubs associated with this provisioning service. + :type iot_hubs: list[~azure.mgmt.iothubprovisioningservices.models.IotHubDefinitionDescription] + :param allocation_policy: Allocation policy to be used by this provisioning service. Possible + values include: "Hashed", "GeoLatency", "Static". + :type allocation_policy: str or ~azure.mgmt.iothubprovisioningservices.models.AllocationPolicy + :ivar service_operations_host_name: Service endpoint for provisioning service. + :vartype service_operations_host_name: str + :ivar device_provisioning_host_name: Device endpoint for this provisioning service. + :vartype device_provisioning_host_name: str + :ivar id_scope: Unique identifier of this provisioning service. + :vartype id_scope: str + :param authorization_policies: List of authorization keys for a provisioning service. + :type authorization_policies: + list[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription] + """ + + _validation = { + 'service_operations_host_name': {'readonly': True}, + 'device_provisioning_host_name': {'readonly': True}, + 'id_scope': {'readonly': True}, + } + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'iot_hubs': {'key': 'iotHubs', 'type': '[IotHubDefinitionDescription]'}, + 'allocation_policy': {'key': 'allocationPolicy', 'type': 'str'}, + 'service_operations_host_name': {'key': 'serviceOperationsHostName', 'type': 'str'}, + 'device_provisioning_host_name': {'key': 'deviceProvisioningHostName', 'type': 'str'}, + 'id_scope': {'key': 'idScope', 'type': 'str'}, + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRuleAccessRightsDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(IotDpsPropertiesDescription, self).__init__(**kwargs) + self.state = kwargs.get('state', None) + self.public_network_access = kwargs.get('public_network_access', None) + self.ip_filter_rules = kwargs.get('ip_filter_rules', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.iot_hubs = kwargs.get('iot_hubs', None) + self.allocation_policy = kwargs.get('allocation_policy', None) + self.service_operations_host_name = None + self.device_provisioning_host_name = None + self.id_scope = None + self.authorization_policies = kwargs.get('authorization_policies', None) + + +class IotDpsSkuDefinition(msrest.serialization.Model): + """Available SKUs of tier and units. + + :param name: Sku name. Possible values include: "S1". + :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotDpsSkuDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class IotDpsSkuDefinitionListResult(msrest.serialization.Model): + """List of available SKUs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of SKUs. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinition] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotDpsSkuDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotDpsSkuDefinitionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotDpsSkuInfo(msrest.serialization.Model): + """List of possible provisioning service SKUs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: Sku name. Possible values include: "S1". + :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku + :ivar tier: Pricing tier name of the provisioning service. + :vartype tier: str + :param capacity: The number of units to provision. + :type capacity: long + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotDpsSkuInfo, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = None + self.capacity = kwargs.get('capacity', None) + + +class IotHubDefinitionDescription(msrest.serialization.Model): + """Description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param apply_allocation_policy: flag for applying allocationPolicy or not for a given iot hub. + :type apply_allocation_policy: bool + :param allocation_weight: weight to apply for a given iot h. + :type allocation_weight: int + :ivar name: Host name of the IoT hub. + :vartype name: str + :param connection_string: Required. Connection string of the IoT hub. + :type connection_string: str + :param location: Required. ARM region of the IoT hub. + :type location: str + """ + + _validation = { + 'name': {'readonly': True}, + 'connection_string': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'apply_allocation_policy': {'key': 'applyAllocationPolicy', 'type': 'bool'}, + 'allocation_weight': {'key': 'allocationWeight', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDefinitionDescription, self).__init__(**kwargs) + self.apply_allocation_policy = kwargs.get('apply_allocation_policy', None) + self.allocation_weight = kwargs.get('allocation_weight', None) + self.name = None + self.connection_string = kwargs['connection_string'] + self.location = kwargs['location'] + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for a provisioning Service. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothubprovisioningservices.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + :param target: Target for requests captured by this rule. Possible values include: "all", + "serviceApi", "deviceApi". + :type target: str or ~azure.mgmt.iothubprovisioningservices.models.IpFilterTargetType + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs['action'] + self.ip_mask = kwargs['ip_mask'] + self.target = kwargs.get('target', None) + + +class NameAvailabilityInfo(msrest.serialization.Model): + """Description of name availability. + + :param name_available: specifies if a name is available or not. + :type name_available: bool + :param reason: specifies the reason a name is unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.iothubprovisioningservices.models.NameUnavailabilityReason + :param message: message containing a detailed reason name is unavailable. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = kwargs.get('message', None) + + +class Operation(msrest.serialization.Model): + """Provisioning Service REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothubprovisioningservices.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: ProvisioningServices. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationInputs(msrest.serialization.Model): + """Input values for operation results call. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Provisioning Service to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list provisioning service operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Provisioning service operations supported by the Microsoft.Devices resource + provider. + :vartype value: list[~azure.mgmt.iothubprovisioningservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of a provisioning service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties of a private endpoint connection. + :type properties: + ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothubprovisioningservices.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs['private_link_service_connection_state'] + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for a provisioning service. + + :param value: The list of available private link resources for a provisioning service. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.iothubprovisioningservices.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs['status'] + self.description = kwargs['description'] + self.actions_required = kwargs.get('actions_required', None) + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class ProvisioningServiceDescription(Resource): + """The description of the provisioning service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: Required. Service specific properties for a provisioning service. + :type properties: ~azure.mgmt.iothubprovisioningservices.models.IotDpsPropertiesDescription + :param sku: Required. Sku info for a provisioning Service. + :type sku: ~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotDpsPropertiesDescription'}, + 'sku': {'key': 'sku', 'type': 'IotDpsSkuInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(ProvisioningServiceDescription, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.properties = kwargs['properties'] + self.sku = kwargs['sku'] + + +class ProvisioningServiceDescriptionListResult(msrest.serialization.Model): + """List of provisioning service descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of provisioning service descriptions. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] + :ivar next_link: the next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProvisioningServiceDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProvisioningServiceDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class SharedAccessSignatureAuthorizationRuleAccessRightsDescription(msrest.serialization.Model): + """Description of the shared access key. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Name of the key. + :type key_name: str + :param primary_key: Primary SAS key value. + :type primary_key: str + :param secondary_key: Secondary SAS key value. + :type secondary_key: str + :param rights: Required. Rights that this key has. Possible values include: "ServiceConfig", + "EnrollmentRead", "EnrollmentWrite", "DeviceConnect", "RegistrationStatusRead", + "RegistrationStatusWrite". + :type rights: str or ~azure.mgmt.iothubprovisioningservices.models.AccessRightsDescription + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleAccessRightsDescription, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.rights = kwargs['rights'] + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """List of shared access keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: + list[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRuleAccessRightsDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a Provisioning Service instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class VerificationCodeRequest(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VerificationCodeRequest, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class VerificationCodeResponse(msrest.serialization.Model): + """Description of the response of the verification code. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of certificate. + :vartype name: str + :ivar etag: Request etag. + :vartype etag: str + :ivar id: The resource identifier. + :vartype id: str + :ivar type: The resource type. + :vartype type: str + :param properties: + :type properties: + ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeResponseProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'VerificationCodeResponseProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(VerificationCodeResponse, self).__init__(**kwargs) + self.name = None + self.etag = None + self.id = None + self.type = None + self.properties = kwargs.get('properties', None) + + +class VerificationCodeResponseProperties(msrest.serialization.Model): + """VerificationCodeResponseProperties. + + :param verification_code: Verification code. + :type verification_code: str + :param subject: Certificate subject. + :type subject: str + :param expiry: Code expiry. + :type expiry: str + :param thumbprint: Certificate thumbprint. + :type thumbprint: str + :param is_verified: Indicate if the certificate is verified by owner of private key. + :type is_verified: bool + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: bytearray + :param created: Certificate created time. + :type created: str + :param updated: Certificate updated time. + :type updated: str + """ + + _attribute_map = { + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'certificate': {'key': 'certificate', 'type': 'bytearray'}, + 'created': {'key': 'created', 'type': 'str'}, + 'updated': {'key': 'updated', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VerificationCodeResponseProperties, self).__init__(**kwargs) + self.verification_code = kwargs.get('verification_code', None) + self.subject = kwargs.get('subject', None) + self.expiry = kwargs.get('expiry', None) + self.thumbprint = kwargs.get('thumbprint', None) + self.is_verified = kwargs.get('is_verified', None) + self.certificate = kwargs.get('certificate', None) + self.created = kwargs.get('created', None) + self.updated = kwargs.get('updated', None) 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 new file mode 100644 index 000000000000..043323238efd --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/_models_py3.py @@ -0,0 +1,1287 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._iot_dps_client_enums import * + + +class AsyncOperationResult(msrest.serialization.Model): + """Result of a long running operation. + + :param status: current status of a long running operation. + :type status: str + :param error: Error message containing code, description and details. + :type error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMesssage + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorMesssage'}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ErrorMesssage"] = None, + **kwargs + ): + super(AsyncOperationResult, self).__init__(**kwargs) + self.status = status + self.error = error + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: Base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.CertificateResponse] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateResponse]'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateResponse"]] = None, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = value + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :vartype certificate: bytearray + :ivar created: The certificate's creation date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'certificate': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'certificate': {'key': 'certificate', 'type': 'bytearray'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.certificate = None + self.created = None + self.updated = None + + +class CertificateResponse(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: properties of a certificate. + :type properties: ~azure.mgmt.iothubprovisioningservices.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + super(CertificateResponse, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class ErrorMesssage(msrest.serialization.Model): + """Error response containing message and code. + + :param code: standard error code. + :type code: str + :param message: standard error description. + :type message: str + :param details: detailed summary of error. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[str] = None, + **kwargs + ): + super(ErrorMesssage, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on a provisioning service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothubprovisioningservices.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + *, + properties: "GroupIdInformationProperties", + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class IotDpsPropertiesDescription(msrest.serialization.Model): + """the service specific properties of a provisioning service, including keys, linked iot hubs, current state, and system generated properties such as hostname and idScope. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param state: Current state of the provisioning service. Possible values include: "Activating", + "Active", "Deleting", "Deleted", "ActivationFailed", "DeletionFailed", "Transitioning", + "Suspending", "Suspended", "Resuming", "FailingOver", "FailoverFailed". + :type state: str or ~azure.mgmt.iothubprovisioningservices.models.State + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.iothubprovisioningservices.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothubprovisioningservices.models.IpFilterRule] + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :param provisioning_state: The ARM provisioning state of the provisioning service. + :type provisioning_state: str + :param iot_hubs: List of IoT hubs associated with this provisioning service. + :type iot_hubs: list[~azure.mgmt.iothubprovisioningservices.models.IotHubDefinitionDescription] + :param allocation_policy: Allocation policy to be used by this provisioning service. Possible + values include: "Hashed", "GeoLatency", "Static". + :type allocation_policy: str or ~azure.mgmt.iothubprovisioningservices.models.AllocationPolicy + :ivar service_operations_host_name: Service endpoint for provisioning service. + :vartype service_operations_host_name: str + :ivar device_provisioning_host_name: Device endpoint for this provisioning service. + :vartype device_provisioning_host_name: str + :ivar id_scope: Unique identifier of this provisioning service. + :vartype id_scope: str + :param authorization_policies: List of authorization keys for a provisioning service. + :type authorization_policies: + list[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription] + """ + + _validation = { + 'service_operations_host_name': {'readonly': True}, + 'device_provisioning_host_name': {'readonly': True}, + 'id_scope': {'readonly': True}, + } + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'iot_hubs': {'key': 'iotHubs', 'type': '[IotHubDefinitionDescription]'}, + 'allocation_policy': {'key': 'allocationPolicy', 'type': 'str'}, + 'service_operations_host_name': {'key': 'serviceOperationsHostName', 'type': 'str'}, + 'device_provisioning_host_name': {'key': 'deviceProvisioningHostName', 'type': 'str'}, + 'id_scope': {'key': 'idScope', 'type': 'str'}, + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRuleAccessRightsDescription]'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "State"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + ip_filter_rules: Optional[List["IpFilterRule"]] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + provisioning_state: Optional[str] = None, + iot_hubs: Optional[List["IotHubDefinitionDescription"]] = None, + allocation_policy: Optional[Union[str, "AllocationPolicy"]] = None, + authorization_policies: Optional[List["SharedAccessSignatureAuthorizationRuleAccessRightsDescription"]] = None, + **kwargs + ): + super(IotDpsPropertiesDescription, self).__init__(**kwargs) + self.state = state + self.public_network_access = public_network_access + self.ip_filter_rules = ip_filter_rules + self.private_endpoint_connections = private_endpoint_connections + self.provisioning_state = provisioning_state + self.iot_hubs = iot_hubs + self.allocation_policy = allocation_policy + self.service_operations_host_name = None + self.device_provisioning_host_name = None + self.id_scope = None + self.authorization_policies = authorization_policies + + +class IotDpsSkuDefinition(msrest.serialization.Model): + """Available SKUs of tier and units. + + :param name: Sku name. Possible values include: "S1". + :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "IotDpsSku"]] = None, + **kwargs + ): + super(IotDpsSkuDefinition, self).__init__(**kwargs) + self.name = name + + +class IotDpsSkuDefinitionListResult(msrest.serialization.Model): + """List of available SKUs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of SKUs. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinition] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotDpsSkuDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotDpsSkuDefinition"]] = None, + **kwargs + ): + super(IotDpsSkuDefinitionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotDpsSkuInfo(msrest.serialization.Model): + """List of possible provisioning service SKUs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: Sku name. Possible values include: "S1". + :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku + :ivar tier: Pricing tier name of the provisioning service. + :vartype tier: str + :param capacity: The number of units to provision. + :type capacity: long + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "IotDpsSku"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(IotDpsSkuInfo, self).__init__(**kwargs) + self.name = name + self.tier = None + self.capacity = capacity + + +class IotHubDefinitionDescription(msrest.serialization.Model): + """Description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param apply_allocation_policy: flag for applying allocationPolicy or not for a given iot hub. + :type apply_allocation_policy: bool + :param allocation_weight: weight to apply for a given iot h. + :type allocation_weight: int + :ivar name: Host name of the IoT hub. + :vartype name: str + :param connection_string: Required. Connection string of the IoT hub. + :type connection_string: str + :param location: Required. ARM region of the IoT hub. + :type location: str + """ + + _validation = { + 'name': {'readonly': True}, + 'connection_string': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'apply_allocation_policy': {'key': 'applyAllocationPolicy', 'type': 'bool'}, + 'allocation_weight': {'key': 'allocationWeight', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + connection_string: str, + location: str, + apply_allocation_policy: Optional[bool] = None, + allocation_weight: Optional[int] = None, + **kwargs + ): + super(IotHubDefinitionDescription, self).__init__(**kwargs) + self.apply_allocation_policy = apply_allocation_policy + self.allocation_weight = allocation_weight + self.name = None + self.connection_string = connection_string + self.location = location + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for a provisioning Service. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothubprovisioningservices.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + :param target: Target for requests captured by this rule. Possible values include: "all", + "serviceApi", "deviceApi". + :type target: str or ~azure.mgmt.iothubprovisioningservices.models.IpFilterTargetType + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + action: Union[str, "IpFilterActionType"], + ip_mask: str, + target: Optional[Union[str, "IpFilterTargetType"]] = None, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + self.target = target + + +class NameAvailabilityInfo(msrest.serialization.Model): + """Description of name availability. + + :param name_available: specifies if a name is available or not. + :type name_available: bool + :param reason: specifies the reason a name is unavailable. Possible values include: "Invalid", + "AlreadyExists". + :type reason: str or ~azure.mgmt.iothubprovisioningservices.models.NameUnavailabilityReason + :param message: message containing a detailed reason name is unavailable. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "NameUnavailabilityReason"]] = None, + message: Optional[str] = None, + **kwargs + ): + super(NameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class Operation(msrest.serialization.Model): + """Provisioning Service REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothubprovisioningservices.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: ProvisioningServices. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationInputs(msrest.serialization.Model): + """Input values for operation results call. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Provisioning Service to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = name + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list provisioning service operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Provisioning service operations supported by the Microsoft.Devices resource + provider. + :vartype value: list[~azure.mgmt.iothubprovisioningservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of a provisioning service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties of a private endpoint connection. + :type properties: + ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + *, + properties: "PrivateEndpointConnectionProperties", + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothubprovisioningservices.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + *, + private_link_service_connection_state: "PrivateLinkServiceConnectionState", + private_endpoint: Optional["PrivateEndpoint"] = None, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for a provisioning service. + + :param value: The list of available private link resources for a provisioning service. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + *, + value: Optional[List["GroupIdInformation"]] = None, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.iothubprovisioningservices.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Union[str, "PrivateLinkServiceConnectionStatus"], + description: str, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ProvisioningServiceDescription(Resource): + """The description of the provisioning service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: Required. Service specific properties for a provisioning service. + :type properties: ~azure.mgmt.iothubprovisioningservices.models.IotDpsPropertiesDescription + :param sku: Required. Sku info for a provisioning Service. + :type sku: ~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotDpsPropertiesDescription'}, + 'sku': {'key': 'sku', 'type': 'IotDpsSkuInfo'}, + } + + def __init__( + self, + *, + location: str, + properties: "IotDpsPropertiesDescription", + sku: "IotDpsSkuInfo", + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + **kwargs + ): + super(ProvisioningServiceDescription, self).__init__(location=location, tags=tags, **kwargs) + self.etag = etag + self.properties = properties + self.sku = sku + + +class ProvisioningServiceDescriptionListResult(msrest.serialization.Model): + """List of provisioning service descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of provisioning service descriptions. + :type value: list[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] + :ivar next_link: the next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProvisioningServiceDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ProvisioningServiceDescription"]] = None, + **kwargs + ): + super(ProvisioningServiceDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SharedAccessSignatureAuthorizationRuleAccessRightsDescription(msrest.serialization.Model): + """Description of the shared access key. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Name of the key. + :type key_name: str + :param primary_key: Primary SAS key value. + :type primary_key: str + :param secondary_key: Secondary SAS key value. + :type secondary_key: str + :param rights: Required. Rights that this key has. Possible values include: "ServiceConfig", + "EnrollmentRead", "EnrollmentWrite", "DeviceConnect", "RegistrationStatusRead", + "RegistrationStatusWrite". + :type rights: str or ~azure.mgmt.iothubprovisioningservices.models.AccessRightsDescription + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + rights: Union[str, "AccessRightsDescription"], + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleAccessRightsDescription, self).__init__(**kwargs) + self.key_name = key_name + self.primary_key = primary_key + self.secondary_key = secondary_key + self.rights = rights + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """List of shared access keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: + list[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRuleAccessRightsDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedAccessSignatureAuthorizationRuleAccessRightsDescription"]] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a Provisioning Service instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = tags + + +class VerificationCodeRequest(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(VerificationCodeRequest, self).__init__(**kwargs) + self.certificate = certificate + + +class VerificationCodeResponse(msrest.serialization.Model): + """Description of the response of the verification code. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of certificate. + :vartype name: str + :ivar etag: Request etag. + :vartype etag: str + :ivar id: The resource identifier. + :vartype id: str + :ivar type: The resource type. + :vartype type: str + :param properties: + :type properties: + ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeResponseProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'VerificationCodeResponseProperties'}, + } + + def __init__( + self, + *, + properties: Optional["VerificationCodeResponseProperties"] = None, + **kwargs + ): + super(VerificationCodeResponse, self).__init__(**kwargs) + self.name = None + self.etag = None + self.id = None + self.type = None + self.properties = properties + + +class VerificationCodeResponseProperties(msrest.serialization.Model): + """VerificationCodeResponseProperties. + + :param verification_code: Verification code. + :type verification_code: str + :param subject: Certificate subject. + :type subject: str + :param expiry: Code expiry. + :type expiry: str + :param thumbprint: Certificate thumbprint. + :type thumbprint: str + :param is_verified: Indicate if the certificate is verified by owner of private key. + :type is_verified: bool + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: bytearray + :param created: Certificate created time. + :type created: str + :param updated: Certificate updated time. + :type updated: str + """ + + _attribute_map = { + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'certificate': {'key': 'certificate', 'type': 'bytearray'}, + 'created': {'key': 'created', 'type': 'str'}, + 'updated': {'key': 'updated', 'type': 'str'}, + } + + def __init__( + self, + *, + verification_code: Optional[str] = None, + subject: Optional[str] = None, + expiry: Optional[str] = None, + thumbprint: Optional[str] = None, + is_verified: Optional[bool] = None, + certificate: Optional[bytearray] = None, + created: Optional[str] = None, + updated: Optional[str] = None, + **kwargs + ): + super(VerificationCodeResponseProperties, self).__init__(**kwargs) + self.verification_code = verification_code + self.subject = subject + self.expiry = expiry + self.thumbprint = thumbprint + self.is_verified = is_verified + self.certificate = certificate + self.created = created + self.updated = updated diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result.py deleted file mode 100644 index d220a92098f5..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AsyncOperationResult(Model): - """Result of a long running operation. - - :param status: current status of a long running operation. - :type status: str - :param error: Error message containing code, description and details - :type error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMesssage - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'ErrorMesssage'}, - } - - def __init__(self, **kwargs): - super(AsyncOperationResult, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.error = kwargs.get('error', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result_py3.py deleted file mode 100644 index d4365e11a55b..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result_py3.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AsyncOperationResult(Model): - """Result of a long running operation. - - :param status: current status of a long running operation. - :type status: str - :param error: Error message containing code, description and details - :type error: ~azure.mgmt.iothubprovisioningservices.models.ErrorMesssage - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'ErrorMesssage'}, - } - - def __init__(self, *, status: str=None, error=None, **kwargs) -> None: - super(AsyncOperationResult, self).__init__(**kwargs) - self.status = status - self.error = error diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description.py deleted file mode 100644 index a35e4c3fa2dd..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateBodyDescription(Model): - """The JSON-serialized X509 Certificate. - - :param certificate: Base-64 representation of the X509 leaf certificate - .cer file or just .pem file content. - :type certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(CertificateBodyDescription, self).__init__(**kwargs) - self.certificate = kwargs.get('certificate', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description_py3.py deleted file mode 100644 index 0383312e8b38..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateBodyDescription(Model): - """The JSON-serialized X509 Certificate. - - :param certificate: Base-64 representation of the X509 leaf certificate - .cer file or just .pem file content. - :type certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__(self, *, certificate: str=None, **kwargs) -> None: - super(CertificateBodyDescription, self).__init__(**kwargs) - self.certificate = certificate diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description.py deleted file mode 100644 index e48e46d87abc..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateListDescription(Model): - """The JSON-serialized array of Certificate objects. - - :param value: The array of Certificate objects. - :type value: - list[~azure.mgmt.iothubprovisioningservices.models.CertificateResponse] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResponse]'}, - } - - def __init__(self, **kwargs): - super(CertificateListDescription, self).__init__(**kwargs) - self.value = kwargs.get('value', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description_py3.py deleted file mode 100644 index 3c86d0ce38e6..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateListDescription(Model): - """The JSON-serialized array of Certificate objects. - - :param value: The array of Certificate objects. - :type value: - list[~azure.mgmt.iothubprovisioningservices.models.CertificateResponse] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResponse]'}, - } - - def __init__(self, *, value=None, **kwargs) -> None: - super(CertificateListDescription, self).__init__(**kwargs) - self.value = value diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties.py deleted file mode 100644 index d38a4e83a28c..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateProperties(Model): - """The description of an X509 CA Certificate. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar subject: The certificate's subject name. - :vartype subject: str - :ivar expiry: The certificate's expiration date and time. - :vartype expiry: datetime - :ivar thumbprint: The certificate's thumbprint. - :vartype thumbprint: str - :ivar is_verified: Determines whether certificate has been verified. - :vartype is_verified: bool - :ivar created: The certificate's creation date and time. - :vartype created: datetime - :ivar updated: The certificate's last update date and time. - :vartype updated: datetime - """ - - _validation = { - 'subject': {'readonly': True}, - 'expiry': {'readonly': True}, - 'thumbprint': {'readonly': True}, - 'is_verified': {'readonly': True}, - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'is_verified': {'key': 'isVerified', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'rfc-1123'}, - 'updated': {'key': 'updated', 'type': 'rfc-1123'}, - } - - def __init__(self, **kwargs): - super(CertificateProperties, self).__init__(**kwargs) - self.subject = None - self.expiry = None - self.thumbprint = None - self.is_verified = None - self.created = None - self.updated = None diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties_py3.py deleted file mode 100644 index c7bdf10c5550..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties_py3.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateProperties(Model): - """The description of an X509 CA Certificate. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar subject: The certificate's subject name. - :vartype subject: str - :ivar expiry: The certificate's expiration date and time. - :vartype expiry: datetime - :ivar thumbprint: The certificate's thumbprint. - :vartype thumbprint: str - :ivar is_verified: Determines whether certificate has been verified. - :vartype is_verified: bool - :ivar created: The certificate's creation date and time. - :vartype created: datetime - :ivar updated: The certificate's last update date and time. - :vartype updated: datetime - """ - - _validation = { - 'subject': {'readonly': True}, - 'expiry': {'readonly': True}, - 'thumbprint': {'readonly': True}, - 'is_verified': {'readonly': True}, - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'is_verified': {'key': 'isVerified', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'rfc-1123'}, - 'updated': {'key': 'updated', 'type': 'rfc-1123'}, - } - - def __init__(self, **kwargs) -> None: - super(CertificateProperties, self).__init__(**kwargs) - self.subject = None - self.expiry = None - self.thumbprint = None - self.is_verified = None - self.created = None - self.updated = None diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response.py deleted file mode 100644 index 6a4ff8db3d87..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateResponse(Model): - """The X509 Certificate. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param properties: properties of a certificate - :type properties: - ~azure.mgmt.iothubprovisioningservices.models.CertificateProperties - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The name of the certificate. - :vartype name: str - :ivar etag: The entity tag. - :vartype etag: str - :ivar type: The resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(CertificateResponse, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.id = None - self.name = None - self.etag = None - self.type = None diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response_py3.py deleted file mode 100644 index a551bc58c285..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response_py3.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CertificateResponse(Model): - """The X509 Certificate. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param properties: properties of a certificate - :type properties: - ~azure.mgmt.iothubprovisioningservices.models.CertificateProperties - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The name of the certificate. - :vartype name: str - :ivar etag: The entity tag. - :vartype etag: str - :ivar type: The resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, *, properties=None, **kwargs) -> None: - super(CertificateResponse, self).__init__(**kwargs) - self.properties = properties - self.id = None - self.name = None - self.etag = None - self.type = None diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details.py deleted file mode 100644 index 77a408028562..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError - - -class ErrorDetails(Model): - """Error details. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar http_status_code: The HTTP status code. - :vartype http_status_code: str - :ivar message: The error message. - :vartype message: str - :ivar details: The error details. - :vartype details: str - """ - - _validation = { - 'code': {'readonly': True}, - 'http_status_code': {'readonly': True}, - 'message': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ErrorDetails, self).__init__(**kwargs) - self.code = None - self.http_status_code = None - self.message = None - self.details = None - - -class ErrorDetailsException(HttpOperationError): - """Server responsed with exception of type: 'ErrorDetails'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorDetailsException, self).__init__(deserialize, response, 'ErrorDetails', *args) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details_py3.py deleted file mode 100644 index a78684fab905..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details_py3.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError - - -class ErrorDetails(Model): - """Error details. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar http_status_code: The HTTP status code. - :vartype http_status_code: str - :ivar message: The error message. - :vartype message: str - :ivar details: The error details. - :vartype details: str - """ - - _validation = { - 'code': {'readonly': True}, - 'http_status_code': {'readonly': True}, - 'message': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(ErrorDetails, self).__init__(**kwargs) - self.code = None - self.http_status_code = None - self.message = None - self.details = None - - -class ErrorDetailsException(HttpOperationError): - """Server responsed with exception of type: 'ErrorDetails'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorDetailsException, self).__init__(deserialize, response, 'ErrorDetails', *args) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage.py deleted file mode 100644 index ecec0bf5636a..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ErrorMesssage(Model): - """Error response containing message and code. - - :param code: standard error code - :type code: str - :param message: standard error description - :type message: str - :param details: detailed summary of error - :type details: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ErrorMesssage, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage_py3.py deleted file mode 100644 index c430f625fe45..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage_py3.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ErrorMesssage(Model): - """Error response containing message and code. - - :param code: standard error code - :type code: str - :param message: standard error description - :type message: str - :param details: detailed summary of error - :type details: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - } - - def __init__(self, *, code: str=None, message: str=None, details: str=None, **kwargs) -> None: - super(ErrorMesssage, self).__init__(**kwargs) - self.code = code - self.message = message - self.details = details diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_client_enums.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_client_enums.py deleted file mode 100644 index dd0012dda30c..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_client_enums.py +++ /dev/null @@ -1,62 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum - - -class IotDpsSku(str, Enum): - - s1 = "S1" - - -class State(str, Enum): - - activating = "Activating" - active = "Active" - deleting = "Deleting" - deleted = "Deleted" - activation_failed = "ActivationFailed" - deletion_failed = "DeletionFailed" - transitioning = "Transitioning" - suspending = "Suspending" - suspended = "Suspended" - resuming = "Resuming" - failing_over = "FailingOver" - failover_failed = "FailoverFailed" - - -class AllocationPolicy(str, Enum): - - hashed = "Hashed" - geo_latency = "GeoLatency" - static = "Static" - - -class AccessRightsDescription(str, Enum): - - service_config = "ServiceConfig" - enrollment_read = "EnrollmentRead" - enrollment_write = "EnrollmentWrite" - device_connect = "DeviceConnect" - registration_status_read = "RegistrationStatusRead" - registration_status_write = "RegistrationStatusWrite" - - -class NameUnavailabilityReason(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" - - -class CertificatePurpose(str, Enum): - - client_authentication = "clientAuthentication" - server_authentication = "serverAuthentication" diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description.py deleted file mode 100644 index 1dadb948a1ab..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotDpsPropertiesDescription(Model): - """the service specific properties of a provisoning service, including keys, - linked iot hubs, current state, and system generated properties such as - hostname and idScope. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param state: Current state of the provisioning service. Possible values - include: 'Activating', 'Active', 'Deleting', 'Deleted', - 'ActivationFailed', 'DeletionFailed', 'Transitioning', 'Suspending', - 'Suspended', 'Resuming', 'FailingOver', 'FailoverFailed' - :type state: str or ~azure.mgmt.iothubprovisioningservices.models.State - :param provisioning_state: The ARM provisioning state of the provisioning - service. - :type provisioning_state: str - :param iot_hubs: List of IoT hubs assosciated with this provisioning - service. - :type iot_hubs: - list[~azure.mgmt.iothubprovisioningservices.models.IotHubDefinitionDescription] - :param allocation_policy: Allocation policy to be used by this - provisioning service. Possible values include: 'Hashed', 'GeoLatency', - 'Static' - :type allocation_policy: str or - ~azure.mgmt.iothubprovisioningservices.models.AllocationPolicy - :ivar service_operations_host_name: Service endpoint for provisioning - service. - :vartype service_operations_host_name: str - :ivar device_provisioning_host_name: Device endpoint for this provisioning - service. - :vartype device_provisioning_host_name: str - :ivar id_scope: Unique identifier of this provisioning service. - :vartype id_scope: str - :param authorization_policies: List of authorization keys for a - provisioning service. - :type authorization_policies: - list[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription] - """ - - _validation = { - 'service_operations_host_name': {'readonly': True}, - 'device_provisioning_host_name': {'readonly': True}, - 'id_scope': {'readonly': True}, - } - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'iot_hubs': {'key': 'iotHubs', 'type': '[IotHubDefinitionDescription]'}, - 'allocation_policy': {'key': 'allocationPolicy', 'type': 'str'}, - 'service_operations_host_name': {'key': 'serviceOperationsHostName', 'type': 'str'}, - 'device_provisioning_host_name': {'key': 'deviceProvisioningHostName', 'type': 'str'}, - 'id_scope': {'key': 'idScope', 'type': 'str'}, - 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRuleAccessRightsDescription]'}, - } - - def __init__(self, **kwargs): - super(IotDpsPropertiesDescription, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.iot_hubs = kwargs.get('iot_hubs', None) - self.allocation_policy = kwargs.get('allocation_policy', None) - self.service_operations_host_name = None - self.device_provisioning_host_name = None - self.id_scope = None - self.authorization_policies = kwargs.get('authorization_policies', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description_py3.py deleted file mode 100644 index c8f57abf3473..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description_py3.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotDpsPropertiesDescription(Model): - """the service specific properties of a provisoning service, including keys, - linked iot hubs, current state, and system generated properties such as - hostname and idScope. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param state: Current state of the provisioning service. Possible values - include: 'Activating', 'Active', 'Deleting', 'Deleted', - 'ActivationFailed', 'DeletionFailed', 'Transitioning', 'Suspending', - 'Suspended', 'Resuming', 'FailingOver', 'FailoverFailed' - :type state: str or ~azure.mgmt.iothubprovisioningservices.models.State - :param provisioning_state: The ARM provisioning state of the provisioning - service. - :type provisioning_state: str - :param iot_hubs: List of IoT hubs assosciated with this provisioning - service. - :type iot_hubs: - list[~azure.mgmt.iothubprovisioningservices.models.IotHubDefinitionDescription] - :param allocation_policy: Allocation policy to be used by this - provisioning service. Possible values include: 'Hashed', 'GeoLatency', - 'Static' - :type allocation_policy: str or - ~azure.mgmt.iothubprovisioningservices.models.AllocationPolicy - :ivar service_operations_host_name: Service endpoint for provisioning - service. - :vartype service_operations_host_name: str - :ivar device_provisioning_host_name: Device endpoint for this provisioning - service. - :vartype device_provisioning_host_name: str - :ivar id_scope: Unique identifier of this provisioning service. - :vartype id_scope: str - :param authorization_policies: List of authorization keys for a - provisioning service. - :type authorization_policies: - list[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription] - """ - - _validation = { - 'service_operations_host_name': {'readonly': True}, - 'device_provisioning_host_name': {'readonly': True}, - 'id_scope': {'readonly': True}, - } - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'iot_hubs': {'key': 'iotHubs', 'type': '[IotHubDefinitionDescription]'}, - 'allocation_policy': {'key': 'allocationPolicy', 'type': 'str'}, - 'service_operations_host_name': {'key': 'serviceOperationsHostName', 'type': 'str'}, - 'device_provisioning_host_name': {'key': 'deviceProvisioningHostName', 'type': 'str'}, - 'id_scope': {'key': 'idScope', 'type': 'str'}, - 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRuleAccessRightsDescription]'}, - } - - def __init__(self, *, state=None, provisioning_state: str=None, iot_hubs=None, allocation_policy=None, authorization_policies=None, **kwargs) -> None: - super(IotDpsPropertiesDescription, self).__init__(**kwargs) - self.state = state - self.provisioning_state = provisioning_state - self.iot_hubs = iot_hubs - self.allocation_policy = allocation_policy - self.service_operations_host_name = None - self.device_provisioning_host_name = None - self.id_scope = None - self.authorization_policies = authorization_policies diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition.py deleted file mode 100644 index 02960e4abff9..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotDpsSkuDefinition(Model): - """Available Sku's of tier and units. - - :param name: Sku name. Possible values include: 'S1' - :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(IotDpsSkuDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_paged.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_paged.py deleted file mode 100644 index 981f1fb2599a..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class IotDpsSkuDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`IotDpsSkuDefinition ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[IotDpsSkuDefinition]'} - } - - def __init__(self, *args, **kwargs): - - super(IotDpsSkuDefinitionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_py3.py deleted file mode 100644 index e7b2c7c86a39..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotDpsSkuDefinition(Model): - """Available Sku's of tier and units. - - :param name: Sku name. Possible values include: 'S1' - :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, name=None, **kwargs) -> None: - super(IotDpsSkuDefinition, self).__init__(**kwargs) - self.name = name diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info.py deleted file mode 100644 index a83fefe71efa..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotDpsSkuInfo(Model): - """List of possible provisoning service SKUs. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param name: Sku name. Possible values include: 'S1' - :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku - :ivar tier: Pricing tier name of the provisioning service. - :vartype tier: str - :param capacity: The number of units to provision - :type capacity: long - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'long'}, - } - - def __init__(self, **kwargs): - super(IotDpsSkuInfo, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - self.capacity = kwargs.get('capacity', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info_py3.py deleted file mode 100644 index d1b9a9dbb967..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info_py3.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotDpsSkuInfo(Model): - """List of possible provisoning service SKUs. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param name: Sku name. Possible values include: 'S1' - :type name: str or ~azure.mgmt.iothubprovisioningservices.models.IotDpsSku - :ivar tier: Pricing tier name of the provisioning service. - :vartype tier: str - :param capacity: The number of units to provision - :type capacity: long - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'long'}, - } - - def __init__(self, *, name=None, capacity: int=None, **kwargs) -> None: - super(IotDpsSkuInfo, self).__init__(**kwargs) - self.name = name - self.tier = None - self.capacity = capacity diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description.py deleted file mode 100644 index a5ec8e232bf0..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotHubDefinitionDescription(Model): - """Description of the IoT hub. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param apply_allocation_policy: flag for applying allocationPolicy or not - for a given iot hub. - :type apply_allocation_policy: bool - :param allocation_weight: weight to apply for a given iot h. - :type allocation_weight: int - :ivar name: Host name of the IoT hub. - :vartype name: str - :param connection_string: Required. Connection string og the IoT hub. - :type connection_string: str - :param location: Required. ARM region of the IoT hub. - :type location: str - """ - - _validation = { - 'name': {'readonly': True}, - 'connection_string': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'apply_allocation_policy': {'key': 'applyAllocationPolicy', 'type': 'bool'}, - 'allocation_weight': {'key': 'allocationWeight', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(IotHubDefinitionDescription, self).__init__(**kwargs) - self.apply_allocation_policy = kwargs.get('apply_allocation_policy', None) - self.allocation_weight = kwargs.get('allocation_weight', None) - self.name = None - self.connection_string = kwargs.get('connection_string', None) - self.location = kwargs.get('location', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description_py3.py deleted file mode 100644 index 939dcf435091..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description_py3.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class IotHubDefinitionDescription(Model): - """Description of the IoT hub. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param apply_allocation_policy: flag for applying allocationPolicy or not - for a given iot hub. - :type apply_allocation_policy: bool - :param allocation_weight: weight to apply for a given iot h. - :type allocation_weight: int - :ivar name: Host name of the IoT hub. - :vartype name: str - :param connection_string: Required. Connection string og the IoT hub. - :type connection_string: str - :param location: Required. ARM region of the IoT hub. - :type location: str - """ - - _validation = { - 'name': {'readonly': True}, - 'connection_string': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'apply_allocation_policy': {'key': 'applyAllocationPolicy', 'type': 'bool'}, - 'allocation_weight': {'key': 'allocationWeight', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'connection_string': {'key': 'connectionString', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__(self, *, connection_string: str, location: str, apply_allocation_policy: bool=None, allocation_weight: int=None, **kwargs) -> None: - super(IotHubDefinitionDescription, self).__init__(**kwargs) - self.apply_allocation_policy = apply_allocation_policy - self.allocation_weight = allocation_weight - self.name = None - self.connection_string = connection_string - self.location = location diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info.py deleted file mode 100644 index 1238f282b280..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class NameAvailabilityInfo(Model): - """Description of name availability. - - :param name_available: specifies if a name is available or not - :type name_available: bool - :param reason: specifies the reason a name is unavailable. Possible values - include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.iothubprovisioningservices.models.NameUnavailabilityReason - :param message: message containing a etailed reason name is unavailable - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(NameAvailabilityInfo, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info_py3.py deleted file mode 100644 index 3f0a3ba82210..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info_py3.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class NameAvailabilityInfo(Model): - """Description of name availability. - - :param name_available: specifies if a name is available or not - :type name_available: bool - :param reason: specifies the reason a name is unavailable. Possible values - include: 'Invalid', 'AlreadyExists' - :type reason: str or - ~azure.mgmt.iothubprovisioningservices.models.NameUnavailabilityReason - :param message: message containing a etailed reason name is unavailable - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__(self, *, name_available: bool=None, reason=None, message: str=None, **kwargs) -> None: - super(NameAvailabilityInfo, self).__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation.py deleted file mode 100644 index 6ef6ac9cb76e..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """IoT Hub REST API operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: Operation name: {provider}/{resource}/{read | write | action | - delete} - :vartype name: str - :param display: The object that represents the operation. - :type display: - ~azure.mgmt.iothubprovisioningservices.models.OperationDisplay - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__(self, **kwargs): - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = kwargs.get('display', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display.py deleted file mode 100644 index d198f80a81c1..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationDisplay(Model): - """The object that represents the operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar provider: Service provider: Microsoft Devices. - :vartype provider: str - :ivar resource: Resource Type: ProvisioningServices. - :vartype resource: str - :ivar operation: Name of the operation. - :vartype operation: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display_py3.py deleted file mode 100644 index a1add8843a0a..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display_py3.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationDisplay(Model): - """The object that represents the operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar provider: Service provider: Microsoft Devices. - :vartype provider: str - :ivar resource: Resource Type: ProvisioningServices. - :vartype resource: str - :ivar operation: Name of the operation. - :vartype operation: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs.py deleted file mode 100644 index 09ee8b535542..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationInputs(Model): - """Input values for operation results call. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the Provisioning Service to check. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(OperationInputs, self).__init__(**kwargs) - self.name = kwargs.get('name', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs_py3.py deleted file mode 100644 index f0e2e45af4f7..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs_py3.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationInputs(Model): - """Input values for operation results call. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the Provisioning Service to check. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__(self, *, name: str, **kwargs) -> None: - super(OperationInputs, self).__init__(**kwargs) - self.name = name diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_paged.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_paged.py deleted file mode 100644 index 3f6c7fbeb755..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_py3.py deleted file mode 100644 index e25e19d1f294..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """IoT Hub REST API operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: Operation name: {provider}/{resource}/{read | write | action | - delete} - :vartype name: str - :param display: The object that represents the operation. - :type display: - ~azure.mgmt.iothubprovisioningservices.models.OperationDisplay - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__(self, *, display=None, **kwargs) -> None: - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = display diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description.py deleted file mode 100644 index 1cb1ca6d0178..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class ProvisioningServiceDescription(Resource): - """The description of the provisioning service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: Required. The resource location. - :type location: str - :param tags: The resource tags. - :type tags: dict[str, str] - :param etag: The Etag field is *not* required. If it is provided in the - response body, it must also be provided as a header per the normal ETag - convention. - :type etag: str - :param properties: Required. Service specific properties for a - provisioning service - :type properties: - ~azure.mgmt.iothubprovisioningservices.models.IotDpsPropertiesDescription - :param sku: Required. Sku info for a provisioning Service. - :type sku: ~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuInfo - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'properties': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'IotDpsPropertiesDescription'}, - 'sku': {'key': 'sku', 'type': 'IotDpsSkuInfo'}, - } - - def __init__(self, **kwargs): - super(ProvisioningServiceDescription, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.properties = kwargs.get('properties', None) - self.sku = kwargs.get('sku', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_paged.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_paged.py deleted file mode 100644 index 3f10e4fdb0d5..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class ProvisioningServiceDescriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`ProvisioningServiceDescription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProvisioningServiceDescription]'} - } - - def __init__(self, *args, **kwargs): - - super(ProvisioningServiceDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_py3.py deleted file mode 100644 index 6097e7818e5a..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_py3.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class ProvisioningServiceDescription(Resource): - """The description of the provisioning service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: Required. The resource location. - :type location: str - :param tags: The resource tags. - :type tags: dict[str, str] - :param etag: The Etag field is *not* required. If it is provided in the - response body, it must also be provided as a header per the normal ETag - convention. - :type etag: str - :param properties: Required. Service specific properties for a - provisioning service - :type properties: - ~azure.mgmt.iothubprovisioningservices.models.IotDpsPropertiesDescription - :param sku: Required. Sku info for a provisioning Service. - :type sku: ~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuInfo - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'properties': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'IotDpsPropertiesDescription'}, - 'sku': {'key': 'sku', 'type': 'IotDpsSkuInfo'}, - } - - def __init__(self, *, location: str, properties, sku, tags=None, etag: str=None, **kwargs) -> None: - super(ProvisioningServiceDescription, self).__init__(location=location, tags=tags, **kwargs) - self.etag = etag - self.properties = properties - self.sku = sku diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource.py deleted file mode 100644 index e03d78711115..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Resource(Model): - """The common properties of an Azure resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: Required. The resource location. - :type location: str - :param tags: The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource_py3.py deleted file mode 100644 index 436710184586..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource_py3.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Resource(Model): - """The common properties of an Azure resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: Required. The resource location. - :type location: str - :param tags: The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, location: str, tags=None, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description.py deleted file mode 100644 index d89bb6c46acf..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SharedAccessSignatureAuthorizationRuleAccessRightsDescription(Model): - """Description of the shared access key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. Name of the key. - :type key_name: str - :param primary_key: Primary SAS key value. - :type primary_key: str - :param secondary_key: Secondary SAS key value. - :type secondary_key: str - :param rights: Required. Rights that this key has. Possible values - include: 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', - 'DeviceConnect', 'RegistrationStatusRead', 'RegistrationStatusWrite' - :type rights: str or - ~azure.mgmt.iothubprovisioningservices.models.AccessRightsDescription - """ - - _validation = { - 'key_name': {'required': True}, - 'rights': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'rights': {'key': 'rights', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SharedAccessSignatureAuthorizationRuleAccessRightsDescription, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.primary_key = kwargs.get('primary_key', None) - self.secondary_key = kwargs.get('secondary_key', None) - self.rights = kwargs.get('rights', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_paged.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_paged.py deleted file mode 100644 index 3223713a25e7..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`SharedAccessSignatureAuthorizationRuleAccessRightsDescription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRuleAccessRightsDescription]'} - } - - def __init__(self, *args, **kwargs): - - super(SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_py3.py deleted file mode 100644 index 36235ef85249..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_py3.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SharedAccessSignatureAuthorizationRuleAccessRightsDescription(Model): - """Description of the shared access key. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. Name of the key. - :type key_name: str - :param primary_key: Primary SAS key value. - :type primary_key: str - :param secondary_key: Secondary SAS key value. - :type secondary_key: str - :param rights: Required. Rights that this key has. Possible values - include: 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', - 'DeviceConnect', 'RegistrationStatusRead', 'RegistrationStatusWrite' - :type rights: str or - ~azure.mgmt.iothubprovisioningservices.models.AccessRightsDescription - """ - - _validation = { - 'key_name': {'required': True}, - 'rights': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'rights': {'key': 'rights', 'type': 'str'}, - } - - def __init__(self, *, key_name: str, rights, primary_key: str=None, secondary_key: str=None, **kwargs) -> None: - super(SharedAccessSignatureAuthorizationRuleAccessRightsDescription, self).__init__(**kwargs) - self.key_name = key_name - self.primary_key = primary_key - self.secondary_key = secondary_key - self.rights = rights diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource.py deleted file mode 100644 index 16f684053142..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class TagsResource(Model): - """A container holding only the Tags for a resource, allowing the user to - update the tags on a Provisioning Service instance. - - :param tags: Resource tags - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(TagsResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource_py3.py deleted file mode 100644 index 5afbce93d8c0..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class TagsResource(Model): - """A container holding only the Tags for a resource, allowing the user to - update the tags on a Provisioning Service instance. - - :param tags: Resource tags - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, tags=None, **kwargs) -> None: - super(TagsResource, self).__init__(**kwargs) - self.tags = tags diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request.py deleted file mode 100644 index 1602cc58f886..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VerificationCodeRequest(Model): - """The JSON-serialized leaf certificate. - - :param certificate: base-64 representation of X509 certificate .cer file - or just .pem file content. - :type certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VerificationCodeRequest, self).__init__(**kwargs) - self.certificate = kwargs.get('certificate', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request_py3.py deleted file mode 100644 index 058544415d4b..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VerificationCodeRequest(Model): - """The JSON-serialized leaf certificate. - - :param certificate: base-64 representation of X509 certificate .cer file - or just .pem file content. - :type certificate: str - """ - - _attribute_map = { - 'certificate': {'key': 'certificate', 'type': 'str'}, - } - - def __init__(self, *, certificate: str=None, **kwargs) -> None: - super(VerificationCodeRequest, self).__init__(**kwargs) - self.certificate = certificate diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response.py deleted file mode 100644 index 39d2ae14a87f..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VerificationCodeResponse(Model): - """Description of the response of the verification code. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: Name of certificate. - :vartype name: str - :ivar etag: Request etag. - :vartype etag: str - :ivar id: The resource identifier. - :vartype id: str - :ivar type: The resource type. - :vartype type: str - :param properties: - :type properties: - ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeResponseProperties - """ - - _validation = { - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VerificationCodeResponseProperties'}, - } - - def __init__(self, **kwargs): - super(VerificationCodeResponse, self).__init__(**kwargs) - self.name = None - self.etag = None - self.id = None - self.type = None - self.properties = kwargs.get('properties', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties.py deleted file mode 100644 index db5b81439493..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VerificationCodeResponseProperties(Model): - """VerificationCodeResponseProperties. - - :param verification_code: Verification code. - :type verification_code: str - :param subject: Certificate subject. - :type subject: str - :param expiry: Code expiry. - :type expiry: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param is_verified: Indicate if the certificate is verified by owner of - private key. - :type is_verified: bool - :param created: Certificate created time. - :type created: str - :param updated: Certificate updated time. - :type updated: str - """ - - _attribute_map = { - 'verification_code': {'key': 'verificationCode', 'type': 'str'}, - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'is_verified': {'key': 'isVerified', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'str'}, - 'updated': {'key': 'updated', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VerificationCodeResponseProperties, self).__init__(**kwargs) - self.verification_code = kwargs.get('verification_code', None) - self.subject = kwargs.get('subject', None) - self.expiry = kwargs.get('expiry', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.is_verified = kwargs.get('is_verified', None) - self.created = kwargs.get('created', None) - self.updated = kwargs.get('updated', None) diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties_py3.py deleted file mode 100644 index ed93c35fb395..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties_py3.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VerificationCodeResponseProperties(Model): - """VerificationCodeResponseProperties. - - :param verification_code: Verification code. - :type verification_code: str - :param subject: Certificate subject. - :type subject: str - :param expiry: Code expiry. - :type expiry: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param is_verified: Indicate if the certificate is verified by owner of - private key. - :type is_verified: bool - :param created: Certificate created time. - :type created: str - :param updated: Certificate updated time. - :type updated: str - """ - - _attribute_map = { - 'verification_code': {'key': 'verificationCode', 'type': 'str'}, - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiry': {'key': 'expiry', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'is_verified': {'key': 'isVerified', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'str'}, - 'updated': {'key': 'updated', 'type': 'str'}, - } - - def __init__(self, *, verification_code: str=None, subject: str=None, expiry: str=None, thumbprint: str=None, is_verified: bool=None, created: str=None, updated: str=None, **kwargs) -> None: - super(VerificationCodeResponseProperties, self).__init__(**kwargs) - self.verification_code = verification_code - self.subject = subject - self.expiry = expiry - self.thumbprint = thumbprint - self.is_verified = is_verified - self.created = created - self.updated = updated diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_py3.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_py3.py deleted file mode 100644 index bf0ead104a47..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_py3.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VerificationCodeResponse(Model): - """Description of the response of the verification code. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: Name of certificate. - :vartype name: str - :ivar etag: Request etag. - :vartype etag: str - :ivar id: The resource identifier. - :vartype id: str - :ivar type: The resource type. - :vartype type: str - :param properties: - :type properties: - ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeResponseProperties - """ - - _validation = { - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VerificationCodeResponseProperties'}, - } - - def __init__(self, *, properties=None, **kwargs) -> None: - super(VerificationCodeResponse, self).__init__(**kwargs) - self.name = None - self.etag = None - self.id = None - self.type = None - self.properties = properties diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/__init__.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/__init__.py index fb15e05ea1bd..6d426f86fd28 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/__init__.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/__init__.py @@ -1,17 +1,14 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from .operations import Operations -from .dps_certificate_operations import DpsCertificateOperations -from .iot_dps_resource_operations import IotDpsResourceOperations +from ._operations import Operations +from ._dps_certificate_operations import DpsCertificateOperations +from ._iot_dps_resource_operations import IotDpsResourceOperations __all__ = [ 'Operations', 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 new file mode 100644 index 000000000000..301fa50f3ae4 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_dps_certificate_operations.py @@ -0,0 +1,597 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DpsCertificateOperations(object): + """DpsCertificateOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothubprovisioningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + certificate_name, # type: str + resource_group_name, # type: str + provisioning_service_name, # type: str + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResponse" + """Get the certificate from the provisioning service. + + :param certificate_name: Name of the certificate to retrieve. + :type certificate_name: str + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :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. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + provisioning_service_name, # type: str + certificate_name, # type: str + certificate_description, # type: "_models.CertificateBodyDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResponse" + """Upload the certificate to the provisioning service. + + Add new certificate or update an existing certificate. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: The name of the provisioning service. + :type provisioning_service_name: str + :param certificate_name: The name of the certificate create or update. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothubprovisioningservices.models.CertificateBodyDescription + :param if_match: ETag of the certificate. This is required to update an existing certificate, + and ignored while creating a brand new certificate. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=256, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + if_match, # type: str + provisioning_service_name, # type: str + certificate_name, # type: str + certificate_name1=None, # type: Optional[str] + certificate_raw_bytes=None, # type: Optional[bytearray] + certificate_is_verified=None, # type: Optional[bool] + certificate_purpose=None, # type: Optional[Union[str, "_models.CertificatePurpose"]] + certificate_created=None, # type: Optional[datetime.datetime] + certificate_last_updated=None, # type: Optional[datetime.datetime] + certificate_has_private_key=None, # type: Optional[bool] + certificate_nonce=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the Provisioning Service Certificate. + + Deletes the specified certificate associated with the Provisioning Service. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param if_match: ETag of the certificate. + :type if_match: str + :param provisioning_service_name: The name of the provisioning service. + :type provisioning_service_name: str + :param certificate_name: This is a mandatory field, and is the logical name of the certificate + 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. + :type certificate_name1: str + :param certificate_raw_bytes: Raw data within the certificate. + :type certificate_raw_bytes: bytearray + :param certificate_is_verified: Indicates if certificate has been verified by owner of the + private key. + :type certificate_is_verified: bool + :param certificate_purpose: A description that mentions the purpose of the certificate. + :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose + :param certificate_created: Time the certificate is created. + :type certificate_created: ~datetime.datetime + :param certificate_last_updated: Time the certificate is last updated. + :type certificate_last_updated: ~datetime.datetime + :param certificate_has_private_key: Indicates if the certificate contains a private key. + :type certificate_has_private_key: bool + :param certificate_nonce: Random number generated to indicate Proof of Possession. + :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) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if certificate_name1 is not None: + query_parameters['certificate.name'] = self._serialize.query("certificate_name1", certificate_name1, 'str') + if certificate_raw_bytes is not None: + query_parameters['certificate.rawBytes'] = self._serialize.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + if certificate_is_verified is not None: + query_parameters['certificate.isVerified'] = self._serialize.query("certificate_is_verified", certificate_is_verified, 'bool') + if certificate_purpose is not None: + query_parameters['certificate.purpose'] = self._serialize.query("certificate_purpose", certificate_purpose, 'str') + if certificate_created is not None: + query_parameters['certificate.created'] = self._serialize.query("certificate_created", certificate_created, 'iso-8601') + if certificate_last_updated is not None: + query_parameters['certificate.lastUpdated'] = self._serialize.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + if certificate_has_private_key is not None: + query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificate_has_private_key", certificate_has_private_key, 'bool') + if certificate_nonce is not None: + query_parameters['certificate.nonce'] = self._serialize.query("certificate_nonce", certificate_nonce, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + provisioning_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateListDescription" + """Get all the certificates tied to the provisioning service. + + :param resource_group_name: Name of resource group. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service to retrieve certificates for. + :type provisioning_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates'} # type: ignore + + def generate_verification_code( + self, + certificate_name, # type: str + if_match, # type: str + resource_group_name, # type: str + provisioning_service_name, # type: str + certificate_name1=None, # type: Optional[str] + certificate_raw_bytes=None, # type: Optional[bytearray] + certificate_is_verified=None, # type: Optional[bool] + certificate_purpose=None, # type: Optional[Union[str, "_models.CertificatePurpose"]] + certificate_created=None, # type: Optional[datetime.datetime] + certificate_last_updated=None, # type: Optional[datetime.datetime] + certificate_has_private_key=None, # type: Optional[bool] + certificate_nonce=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VerificationCodeResponse" + """Generate verification code for Proof of Possession. + + :param certificate_name: The mandatory logical name of the certificate, that the provisioning + service uses to access. + :type certificate_name: str + :param if_match: ETag of the certificate. This is required to update an existing certificate, + and ignored while creating a brand new certificate. + :type if_match: str + :param resource_group_name: name of resource group. + :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. + :type certificate_name1: str + :param certificate_raw_bytes: Raw data of certificate. + :type certificate_raw_bytes: bytearray + :param certificate_is_verified: Indicates if the certificate has been verified by owner of the + private key. + :type certificate_is_verified: bool + :param certificate_purpose: Description mentioning the purpose of the certificate. + :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose + :param certificate_created: Certificate creation time. + :type certificate_created: ~datetime.datetime + :param certificate_last_updated: Certificate last updated time. + :type certificate_last_updated: ~datetime.datetime + :param certificate_has_private_key: Indicates if the certificate contains private key. + :type certificate_has_private_key: bool + :param certificate_nonce: Random number generated to indicate Proof of Possession. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VerificationCodeResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if certificate_name1 is not None: + query_parameters['certificate.name'] = self._serialize.query("certificate_name1", certificate_name1, 'str') + if certificate_raw_bytes is not None: + query_parameters['certificate.rawBytes'] = self._serialize.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + if certificate_is_verified is not None: + query_parameters['certificate.isVerified'] = self._serialize.query("certificate_is_verified", certificate_is_verified, 'bool') + if certificate_purpose is not None: + query_parameters['certificate.purpose'] = self._serialize.query("certificate_purpose", certificate_purpose, 'str') + if certificate_created is not None: + query_parameters['certificate.created'] = self._serialize.query("certificate_created", certificate_created, 'iso-8601') + if certificate_last_updated is not None: + query_parameters['certificate.lastUpdated'] = self._serialize.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + if certificate_has_private_key is not None: + query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificate_has_private_key", certificate_has_private_key, 'bool') + if certificate_nonce is not None: + query_parameters['certificate.nonce'] = self._serialize.query("certificate_nonce", certificate_nonce, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VerificationCodeResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + def verify_certificate( + self, + certificate_name, # type: str + if_match, # type: str + resource_group_name, # type: str + provisioning_service_name, # type: str + request, # type: "_models.VerificationCodeRequest" + certificate_name1=None, # type: Optional[str] + certificate_raw_bytes=None, # type: Optional[bytearray] + certificate_is_verified=None, # type: Optional[bool] + certificate_purpose=None, # type: Optional[Union[str, "_models.CertificatePurpose"]] + certificate_created=None, # type: Optional[datetime.datetime] + certificate_last_updated=None, # type: Optional[datetime.datetime] + certificate_has_private_key=None, # type: Optional[bool] + certificate_nonce=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResponse" + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param certificate_name: The mandatory logical name of the certificate, that the provisioning + service uses to access. + :type certificate_name: str + :param if_match: ETag of the certificate. + :type if_match: str + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param provisioning_service_name: Provisioning service name. + :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. + :type certificate_name1: str + :param certificate_raw_bytes: Raw data of certificate. + :type certificate_raw_bytes: bytearray + :param certificate_is_verified: Indicates if the certificate has been verified by owner of the + private key. + :type certificate_is_verified: bool + :param certificate_purpose: Describe the purpose of the certificate. + :type certificate_purpose: str or ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose + :param certificate_created: Certificate creation time. + :type certificate_created: ~datetime.datetime + :param certificate_last_updated: Certificate last updated time. + :type certificate_last_updated: ~datetime.datetime + :param certificate_has_private_key: Indicates if the certificate contains private key. + :type certificate_has_private_key: bool + :param certificate_nonce: Random number generated to indicate Proof of Possession. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if certificate_name1 is not None: + query_parameters['certificate.name'] = self._serialize.query("certificate_name1", certificate_name1, 'str') + if certificate_raw_bytes is not None: + query_parameters['certificate.rawBytes'] = self._serialize.query("certificate_raw_bytes", certificate_raw_bytes, 'bytearray') + if certificate_is_verified is not None: + query_parameters['certificate.isVerified'] = self._serialize.query("certificate_is_verified", certificate_is_verified, 'bool') + if certificate_purpose is not None: + query_parameters['certificate.purpose'] = self._serialize.query("certificate_purpose", certificate_purpose, 'str') + if certificate_created is not None: + query_parameters['certificate.created'] = self._serialize.query("certificate_created", certificate_created, 'iso-8601') + if certificate_last_updated is not None: + query_parameters['certificate.lastUpdated'] = self._serialize.query("certificate_last_updated", certificate_last_updated, 'iso-8601') + if certificate_has_private_key is not None: + query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificate_has_private_key", certificate_has_private_key, 'bool') + if certificate_nonce is not None: + query_parameters['certificate.nonce'] = self._serialize.query("certificate_nonce", certificate_nonce, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, 'VerificationCodeRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..b83e48185913 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_iot_dps_resource_operations.py @@ -0,0 +1,1523 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IotDpsResourceOperations(object): + """IotDpsResourceOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothubprovisioningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + provisioning_service_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ProvisioningServiceDescription" + """Get the non-security related metadata of the provisioning service. + + Get the metadata of the provisioning service without SAS keys. + + :param provisioning_service_name: Name of the provisioning service to retrieve. + :type provisioning_service_name: str + :param resource_group_name: Resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProvisioningServiceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + provisioning_service_name, # type: str + iot_dps_description, # type: "_models.ProvisioningServiceDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.ProvisioningServiceDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_dps_description, 'ProvisioningServiceDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + provisioning_service_name, # type: str + iot_dps_description, # type: "_models.ProvisioningServiceDescription" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ProvisioningServiceDescription"] + """Create or update the metadata of the provisioning service. + + Create or update the metadata of the provisioning service. The usual pattern to modify a + property is to retrieve the provisioning service metadata and security metadata, and then + combine them with the modified values in a new body to update the provisioning service. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service to create or update. + :type provisioning_service_name: str + :param iot_dps_description: Description of the provisioning service to create or update. + :type iot_dps_description: ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ProvisioningServiceDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + provisioning_service_name=provisioning_service_name, + iot_dps_description=iot_dps_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + def _update_initial( + self, + resource_group_name, # type: str + provisioning_service_name, # type: str + provisioning_service_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ProvisioningServiceDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(provisioning_service_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + provisioning_service_name, # type: str + provisioning_service_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ProvisioningServiceDescription"] + """Update an existing provisioning service's tags. + + Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate + method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service to create or update. + :type provisioning_service_name: str + :param provisioning_service_tags: Updated tag information to set into the provisioning service + instance. + :type provisioning_service_tags: ~azure.mgmt.iothubprovisioningservices.models.TagsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ProvisioningServiceDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + provisioning_service_name=provisioning_service_name, + provisioning_service_tags=provisioning_service_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + def _delete_initial( + self, + provisioning_service_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} # type: ignore + + def begin_delete( + self, + provisioning_service_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete the Provisioning Service. + + Deletes the Provisioning Service. + + :param provisioning_service_name: Name of provisioning service to delete. + :type provisioning_service_name: str + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + provisioning_service_name=provisioning_service_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProvisioningServiceDescriptionListResult"] + """Get all the provisioning services in a subscription. + + List all the provisioning services for a given subscription id. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProvisioningServiceDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProvisioningServiceDescriptionListResult"] + """Get a list of all provisioning services in the given resource group. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProvisioningServiceDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProvisioningServiceDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProvisioningServiceDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices'} # type: ignore + + def get_operation_result( + self, + operation_id, # type: str + resource_group_name, # type: str + provisioning_service_name, # type: str + asyncinfo="true", # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AsyncOperationResult" + """Gets the status of a long running operation, such as create, update or delete a provisioning + service. + + :param operation_id: Operation id corresponding to long running operation. Use this to poll for + the status. + :type operation_id: str + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param provisioning_service_name: Name of provisioning service that the operation is running + 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. + :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) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.AsyncOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get_operation_result.metadata['url'] # type: ignore + path_format_arguments = { + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['asyncinfo'] = self._serialize.query("asyncinfo", asyncinfo, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AsyncOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}'} # type: ignore + + def list_valid_skus( + self, + provisioning_service_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotDpsSkuDefinitionListResult"] + """Get the list of valid SKUs for a provisioning service. + + Gets the list of valid SKUs and tiers for a provisioning service. + + :param provisioning_service_name: Name of provisioning service. + :type provisioning_service_name: str + :param resource_group_name: Name of resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotDpsSkuDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotDpsSkuDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotDpsSkuDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus'} # type: ignore + + def check_provisioning_service_name_availability( + self, + arguments, # type: "_models.OperationInputs" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailabilityInfo" + """Check if a provisioning service name is available. + + Check if a provisioning service name is available. This will validate if the name is + syntactically valid and if the name is usable. + + :param arguments: Set the name parameter in the OperationInputs structure to the name of the + provisioning service to check. + :type arguments: ~azure.mgmt.iothubprovisioningservices.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.NameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_provisioning_service_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(arguments, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_provisioning_service_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability'} # type: ignore + + def list_keys( + self, + provisioning_service_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessSignatureAuthorizationRuleListResult"] + """Get the security metadata for a provisioning service. + + List the primary and secondary keys for a provisioning service. + + :param provisioning_service_name: The provisioning service name to get the shared access keys + for. + :type provisioning_service_name: str + :param resource_group_name: resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys'} # type: ignore + + def list_keys_for_key_name( + self, + provisioning_service_name, # type: str + key_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription" + """Get a shared access policy by name from a provisioning service. + + List primary and secondary keys for a specific key name. + + :param provisioning_service_name: Name of the provisioning service. + :type provisioning_service_name: str + :param key_name: Logical key name to get key-values for. + :type key_name: str + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRuleAccessRightsDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleAccessRightsDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys'} # type: ignore + + def list_private_link_resources( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResources" + """List private link resources. + + List private link resources for the given provisioning service. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list_private_link_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources'} # type: ignore + + def get_private_link_resources( + self, + resource_group_name, # type: str + resource_name, # type: str + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GroupIdInformation" + """Get the specified private link resource. + + Get the specified private link resource for the given provisioning service. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get_private_link_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}'} # type: ignore + + def list_private_endpoint_connections( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.PrivateEndpointConnection"] + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.list_private_endpoint_connections.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections'} # type: ignore + + def get_private_endpoint_connection( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self.get_private_endpoint_connection.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_private_endpoint_connection_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_create_or_update_private_endpoint_connection( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Create or update private endpoint connection. + + Create or update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._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, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 + + def _delete_private_endpoint_connection_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_private_endpoint_connection_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete_private_endpoint_connection( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the provisioning + service. + :type resource_group_name: str + :param resource_name: The name of the provisioning service. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_private_endpoint_connection_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 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 new file mode 100644 index 000000000000..30ea78a1286e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothubprovisioningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available Microsoft.Devices REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothubprovisioningservices.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore 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 deleted file mode 100644 index 92b173849272..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/dps_certificate_operations.py +++ /dev/null @@ -1,584 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class DpsCertificateOperations(object): - """DpsCertificateOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The version of the API. Constant value: "2018-01-22". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-01-22" - - self.config = config - - def get( - self, certificate_name, resource_group_name, provisioning_service_name, if_match=None, custom_headers=None, raw=False, **operation_config): - """Get the certificate from the provisioning service. - - :param certificate_name: Name of the certificate to retrieve. - :type certificate_name: str - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :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. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResponse or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('CertificateResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} - - def create_or_update( - self, resource_group_name, provisioning_service_name, certificate_name, if_match=None, certificate=None, custom_headers=None, raw=False, **operation_config): - """Upload the certificate to the provisioning service. - - Add new certificate or update an existing certificate. - - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :param provisioning_service_name: The name of the provisioning - service. - :type provisioning_service_name: str - :param certificate_name: The name of the certificate create or update. - :type certificate_name: str - :param if_match: ETag of the certificate. This is required to update - an existing certificate, and ignored while creating a brand new - certificate. - :type if_match: str - :param certificate: Base-64 representation of the X509 leaf - certificate .cer file or just .pem file content. - :type certificate: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResponse or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - certificate_description = models.CertificateBodyDescription(certificate=certificate) - - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=256) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(certificate_description, 'CertificateBodyDescription') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('CertificateResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} - - def delete( - self, resource_group_name, if_match, provisioning_service_name, certificate_name, certificatename=None, certificateraw_bytes=None, certificateis_verified=None, certificatepurpose=None, certificatecreated=None, certificatelast_updated=None, certificatehas_private_key=None, certificatenonce=None, custom_headers=None, raw=False, **operation_config): - """Delete the Provisioning Service Certificate. - - Deletes the specified certificate assosciated with the Provisioning - Service. - - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :param if_match: ETag of the certificate - :type if_match: str - :param provisioning_service_name: The name of the provisioning - service. - :type provisioning_service_name: str - :param certificate_name: This is a mandatory field, and is the logical - name of the certificate that the provisioning service will access by. - :type certificate_name: str - :param certificatename: This is optional, and it is the Common Name of - the certificate. - :type certificatename: str - :param certificateraw_bytes: Raw data within the certificate. - :type certificateraw_bytes: bytearray - :param certificateis_verified: Indicates if certificate has been - verified by owner of the private key. - :type certificateis_verified: bool - :param certificatepurpose: A description that mentions the purpose of - the certificate. Possible values include: 'clientAuthentication', - 'serverAuthentication' - :type certificatepurpose: str or - ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificatecreated: Time the certificate is created. - :type certificatecreated: datetime - :param certificatelast_updated: Time the certificate is last updated. - :type certificatelast_updated: datetime - :param certificatehas_private_key: Indicates if the certificate - contains a private key. - :type certificatehas_private_key: bool - :param certificatenonce: Random number generated to indicate Proof of - Possession. - :type certificatenonce: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if certificatename is not None: - query_parameters['certificate.name'] = self._serialize.query("certificatename", certificatename, 'str') - if certificateraw_bytes is not None: - query_parameters['certificate.rawBytes'] = self._serialize.query("certificateraw_bytes", certificateraw_bytes, 'bytearray') - if certificateis_verified is not None: - query_parameters['certificate.isVerified'] = self._serialize.query("certificateis_verified", certificateis_verified, 'bool') - if certificatepurpose is not None: - query_parameters['certificate.purpose'] = self._serialize.query("certificatepurpose", certificatepurpose, 'str') - if certificatecreated is not None: - query_parameters['certificate.created'] = self._serialize.query("certificatecreated", certificatecreated, 'iso-8601') - if certificatelast_updated is not None: - query_parameters['certificate.lastUpdated'] = self._serialize.query("certificatelast_updated", certificatelast_updated, 'iso-8601') - if certificatehas_private_key is not None: - query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificatehas_private_key", certificatehas_private_key, 'bool') - if certificatenonce is not None: - query_parameters['certificate.nonce'] = self._serialize.query("certificatenonce", certificatenonce, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200, 204]: - raise models.ErrorDetailsException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}'} - - def list( - self, resource_group_name, provisioning_service_name, custom_headers=None, raw=False, **operation_config): - """Get all the certificates tied to the provisioning service. - - :param resource_group_name: Name of resource group. - :type resource_group_name: str - :param provisioning_service_name: Name of provisioning service to - retrieve certificates for. - :type provisioning_service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateListDescription or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.CertificateListDescription - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('CertificateListDescription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates'} - - def generate_verification_code( - self, certificate_name, if_match, resource_group_name, provisioning_service_name, certificatename=None, certificateraw_bytes=None, certificateis_verified=None, certificatepurpose=None, certificatecreated=None, certificatelast_updated=None, certificatehas_private_key=None, certificatenonce=None, custom_headers=None, raw=False, **operation_config): - """Generate verification code for Proof of Possession. - - :param certificate_name: The mandatory logical name of the - certificate, that the provisioning service uses to access. - :type certificate_name: str - :param if_match: ETag of the certificate. This is required to update - an existing certificate, and ignored while creating a brand new - certificate. - :type if_match: str - :param resource_group_name: name of resource group. - :type resource_group_name: str - :param provisioning_service_name: Name of provisioning service. - :type provisioning_service_name: str - :param certificatename: Common Name for the certificate. - :type certificatename: str - :param certificateraw_bytes: Raw data of certificate. - :type certificateraw_bytes: bytearray - :param certificateis_verified: Indicates if the certificate has been - verified by owner of the private key. - :type certificateis_verified: bool - :param certificatepurpose: Description mentioning the purpose of the - certificate. Possible values include: 'clientAuthentication', - 'serverAuthentication' - :type certificatepurpose: str or - ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificatecreated: Certificate creation time. - :type certificatecreated: datetime - :param certificatelast_updated: Certificate last updated time. - :type certificatelast_updated: datetime - :param certificatehas_private_key: Indicates if the certificate - contains private key. - :type certificatehas_private_key: bool - :param certificatenonce: Random number generated to indicate Proof of - Possession. - :type certificatenonce: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VerificationCodeResponse or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.VerificationCodeResponse - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - # Construct URL - url = self.generate_verification_code.metadata['url'] - path_format_arguments = { - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if certificatename is not None: - query_parameters['certificate.name'] = self._serialize.query("certificatename", certificatename, 'str') - if certificateraw_bytes is not None: - query_parameters['certificate.rawBytes'] = self._serialize.query("certificateraw_bytes", certificateraw_bytes, 'bytearray') - if certificateis_verified is not None: - query_parameters['certificate.isVerified'] = self._serialize.query("certificateis_verified", certificateis_verified, 'bool') - if certificatepurpose is not None: - query_parameters['certificate.purpose'] = self._serialize.query("certificatepurpose", certificatepurpose, 'str') - if certificatecreated is not None: - query_parameters['certificate.created'] = self._serialize.query("certificatecreated", certificatecreated, 'iso-8601') - if certificatelast_updated is not None: - query_parameters['certificate.lastUpdated'] = self._serialize.query("certificatelast_updated", certificatelast_updated, 'iso-8601') - if certificatehas_private_key is not None: - query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificatehas_private_key", certificatehas_private_key, 'bool') - if certificatenonce is not None: - query_parameters['certificate.nonce'] = self._serialize.query("certificatenonce", certificatenonce, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationCodeResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode'} - - def verify_certificate( - self, certificate_name, if_match, resource_group_name, provisioning_service_name, certificatename=None, certificateraw_bytes=None, certificateis_verified=None, certificatepurpose=None, certificatecreated=None, certificatelast_updated=None, certificatehas_private_key=None, certificatenonce=None, certificate=None, custom_headers=None, raw=False, **operation_config): - """Verify certificate's private key possession. - - Verifies the certificate's private key possession by providing the leaf - cert issued by the verifying pre uploaded certificate. - - :param certificate_name: The mandatory logical name of the - certificate, that the provisioning service uses to access. - :type certificate_name: str - :param if_match: ETag of the certificate. - :type if_match: str - :param resource_group_name: Resource group name. - :type resource_group_name: str - :param provisioning_service_name: Provisioning service name. - :type provisioning_service_name: str - :param certificatename: Common Name for the certificate. - :type certificatename: str - :param certificateraw_bytes: Raw data of certificate. - :type certificateraw_bytes: bytearray - :param certificateis_verified: Indicates if the certificate has been - verified by owner of the private key. - :type certificateis_verified: bool - :param certificatepurpose: Describe the purpose of the certificate. - Possible values include: 'clientAuthentication', - 'serverAuthentication' - :type certificatepurpose: str or - ~azure.mgmt.iothubprovisioningservices.models.CertificatePurpose - :param certificatecreated: Certificate creation time. - :type certificatecreated: datetime - :param certificatelast_updated: Certificate last updated time. - :type certificatelast_updated: datetime - :param certificatehas_private_key: Indicates if the certificate - contains private key. - :type certificatehas_private_key: bool - :param certificatenonce: Random number generated to indicate Proof of - Possession. - :type certificatenonce: str - :param certificate: base-64 representation of X509 certificate .cer - file or just .pem file content. - :type certificate: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResponse or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.CertificateResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - request = models.VerificationCodeRequest(certificate=certificate) - - # Construct URL - url = self.verify_certificate.metadata['url'] - path_format_arguments = { - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if certificatename is not None: - query_parameters['certificate.name'] = self._serialize.query("certificatename", certificatename, 'str') - if certificateraw_bytes is not None: - query_parameters['certificate.rawBytes'] = self._serialize.query("certificateraw_bytes", certificateraw_bytes, 'bytearray') - if certificateis_verified is not None: - query_parameters['certificate.isVerified'] = self._serialize.query("certificateis_verified", certificateis_verified, 'bool') - if certificatepurpose is not None: - query_parameters['certificate.purpose'] = self._serialize.query("certificatepurpose", certificatepurpose, 'str') - if certificatecreated is not None: - query_parameters['certificate.created'] = self._serialize.query("certificatecreated", certificatecreated, 'iso-8601') - if certificatelast_updated is not None: - query_parameters['certificate.lastUpdated'] = self._serialize.query("certificatelast_updated", certificatelast_updated, 'iso-8601') - if certificatehas_private_key is not None: - query_parameters['certificate.hasPrivateKey'] = self._serialize.query("certificatehas_private_key", certificatehas_private_key, 'bool') - if certificatenonce is not None: - query_parameters['certificate.nonce'] = self._serialize.query("certificatenonce", certificatenonce, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(request, 'VerificationCodeRequest') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('CertificateResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - verify_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify'} 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 deleted file mode 100644 index 05eb37ed4b3c..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/iot_dps_resource_operations.py +++ /dev/null @@ -1,892 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class IotDpsResourceOperations(object): - """IotDpsResourceOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The version of the API. Constant value: "2018-01-22". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-01-22" - - self.config = config - - def get( - self, provisioning_service_name, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Get the non-security related metadata of the provisioning service. - - Get the metadata of the provisioning service without SAS keys. - - :param provisioning_service_name: Name of the provisioning service to - retrieve. - :type provisioning_service_name: str - :param resource_group_name: Resource group name. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ProvisioningServiceDescription or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ProvisioningServiceDescription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} - - - def _create_or_update_initial( - self, resource_group_name, provisioning_service_name, iot_dps_description, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(iot_dps_description, 'ProvisioningServiceDescription') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ProvisioningServiceDescription', response) - if response.status_code == 201: - deserialized = self._deserialize('ProvisioningServiceDescription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, provisioning_service_name, iot_dps_description, custom_headers=None, raw=False, polling=True, **operation_config): - """Create or update the metadata of the provisioning service. - - Create or update the metadata of the provisioning service. The usual - pattern to modify a property is to retrieve the provisioning service - metadata and security metadata, and then combine them with the modified - values in a new body to update the provisioning service. - - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :param provisioning_service_name: Name of provisioning service to - create or update. - :type provisioning_service_name: str - :param iot_dps_description: Description of the provisioning service to - create or update. - :type iot_dps_description: - ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - ProvisioningServiceDescription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription]] - :raises: - :class:`ErrorDetailsException` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - provisioning_service_name=provisioning_service_name, - iot_dps_description=iot_dps_description, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ProvisioningServiceDescription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} - - - def _update_initial( - self, resource_group_name, provisioning_service_name, tags=None, custom_headers=None, raw=False, **operation_config): - provisioning_service_tags = models.TagsResource(tags=tags) - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(provisioning_service_tags, 'TagsResource') - - # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ProvisioningServiceDescription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, provisioning_service_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Update an existing provisioning service's tags. - - Update an existing provisioning service's tags. to update other fields - use the CreateOrUpdate method. - - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :param provisioning_service_name: Name of provisioning service to - create or update. - :type provisioning_service_name: str - :param tags: Resource tags - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - ProvisioningServiceDescription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - provisioning_service_name=provisioning_service_name, - tags=tags, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ProvisioningServiceDescription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} - - - def _delete_initial( - self, provisioning_service_name, resource_group_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204, 404]: - raise models.ErrorDetailsException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, provisioning_service_name, resource_group_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete the Provisioning Service. - - Deletes the Provisioning Service. - - :param provisioning_service_name: Name of provisioning service to - delete. - :type provisioning_service_name: str - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ErrorDetailsException` - """ - raw_result = self._delete_initial( - provisioning_service_name=provisioning_service_name, - resource_group_name=resource_group_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'} - - def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): - """Get all the provisioning services in a subscription. - - List all the provisioning services for a given subscription id. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProvisioningServiceDescription - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] - :raises: - :class:`ErrorDetailsException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.ProvisioningServiceDescriptionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ProvisioningServiceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices'} - - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Get a list of all provisioning services in the given resource group. - - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProvisioningServiceDescription - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription] - :raises: - :class:`ErrorDetailsException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.ProvisioningServiceDescriptionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ProvisioningServiceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices'} - - def get_operation_result( - self, operation_id, resource_group_name, provisioning_service_name, asyncinfo="true", custom_headers=None, raw=False, **operation_config): - """Gets the status of a long running operation, such as create, update or - delete a provisioning service. - - :param operation_id: Operation id corresponding to long running - operation. Use this to poll for the status. - :type operation_id: str - :param resource_group_name: Resource group identifier. - :type resource_group_name: str - :param provisioning_service_name: Name of provisioning service that - the operation is running 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. - :type asyncinfo: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AsyncOperationResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.AsyncOperationResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - # Construct URL - url = self.get_operation_result.metadata['url'] - path_format_arguments = { - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['asyncinfo'] = self._serialize.query("asyncinfo", asyncinfo, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AsyncOperationResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}'} - - def list_valid_skus( - self, provisioning_service_name, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Get the list of valid SKUs for a provisioning service. - - Gets the list of valid SKUs and tiers for a provisioning service. - - :param provisioning_service_name: Name of provisioning service. - :type provisioning_service_name: str - :param resource_group_name: Name of resource group. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of IotDpsSkuDefinition - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinitionPaged[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinition] - :raises: - :class:`ErrorDetailsException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_valid_skus.metadata['url'] - path_format_arguments = { - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.IotDpsSkuDefinitionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.IotDpsSkuDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus'} - - def check_provisioning_service_name_availability( - self, name, custom_headers=None, raw=False, **operation_config): - """Check if a provisioning service name is available. - - Check if a provisioning service name is available. This will validate - if the name is syntactically valid and if the name is usable. - - :param name: The name of the Provisioning Service to check. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NameAvailabilityInfo or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.NameAvailabilityInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - arguments = models.OperationInputs(name=name) - - # Construct URL - url = self.check_provisioning_service_name_availability.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(arguments, 'OperationInputs') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NameAvailabilityInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - check_provisioning_service_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability'} - - def list_keys( - self, provisioning_service_name, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Get the security metadata for a provisioning service. - - List the primary and secondary keys for a provisioning service. - - :param provisioning_service_name: The provisioning service name to get - the shared access keys for. - :type provisioning_service_name: str - :param resource_group_name: resource group name - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of - SharedAccessSignatureAuthorizationRuleAccessRightsDescription - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription] - :raises: - :class:`ErrorDetailsException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_keys.metadata['url'] - path_format_arguments = { - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys'} - - def list_keys_for_key_name( - self, provisioning_service_name, key_name, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Get a shared access policy by name from a provisioning service. - - List primary and secondary keys for a specific key name. - - :param provisioning_service_name: Name of the provisioning service. - :type provisioning_service_name: str - :param key_name: Logical key name to get key-values for. - :type key_name: str - :param resource_group_name: The name of the resource group that - contains the provisioning service. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SharedAccessSignatureAuthorizationRuleAccessRightsDescription - or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorDetailsException` - """ - # Construct URL - url = self.list_keys_for_key_name.metadata['url'] - path_format_arguments = { - 'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'), - 'keyName': self._serialize.url("key_name", key_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleAccessRightsDescription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys'} 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 deleted file mode 100644 index d317e51009a8..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/operations.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class Operations(object): - """Operations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The version of the API. Constant value: "2018-01-22". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2018-01-22" - - self.config = config - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available Microsoft.Devices REST API operations. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.iothubprovisioningservices.models.OperationPaged[~azure.mgmt.iothubprovisioningservices.models.Operation] - :raises: - :class:`ErrorDetailsException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorDetailsException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Devices/operations'} diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/py.typed b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/setup.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/setup.py index 4773a03c3a48..0ba71e973e93 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/setup.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/setup.py @@ -80,8 +80,8 @@ 'azure.mgmt', ]), install_requires=[ - 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', + 'msrest>=0.6.21', + 'azure-mgmt-core>=1.2.0,<2.0.0', 'azure-common~=1.1', ], extras_require={ diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/tests/recordings/test_cli_mgmt_iothubprovisioningservices.test_iothubprovisioningservices.yaml b/sdk/iothub/azure-mgmt-iothubprovisioningservices/tests/recordings/test_cli_mgmt_iothubprovisioningservices.test_iothubprovisioningservices.yaml deleted file mode 100644 index e14b66a79ae6..000000000000 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/tests/recordings/test_cli_mgmt_iothubprovisioningservices.test_iothubprovisioningservices.yaml +++ /dev/null @@ -1,473 +0,0 @@ -interactions: -- request: - body: '{"location": "East US", "properties": {}, "sku": {"name": "S1", "capacity": - 1}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '79' - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - accept-language: - - en-US - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND?api-version=2018-01-22 - response: - body: - string: '{"name":"myProvisioningServiceRND","location":"East US","properties":{"state":"Activating","provisioningState":"Accepted","allocationPolicy":"Hashed","idScope":null},"resourcegroup":"test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44","type":"Microsoft.Devices/provisioningServices","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND","subscriptionid":"00000000-0000-0000-0000-000000000000","tags":{},"sku":{"name":"S1","tier":"Standard","capacity":1}}' - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND/operationResults/b3NfaWRfZjcwOTRiZjctNzQ4OC00MTE0LTg0MDctNTA5NjMwNTQ5NDMx?api-version=2018-01-22&asyncinfo - cache-control: - - no-cache - content-length: - - '659' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:16:40 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '4999' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND/operationResults/b3NfaWRfZjcwOTRiZjctNzQ4OC00MTE0LTg0MDctNTA5NjMwNTQ5NDMx?api-version=2018-01-22&asyncinfo - response: - body: - string: '{"status":"Running"}' - headers: - cache-control: - - no-cache - content-length: - - '20' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:10 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND/operationResults/b3NfaWRfZjcwOTRiZjctNzQ4OC00MTE0LTg0MDctNTA5NjMwNTQ5NDMx?api-version=2018-01-22&asyncinfo - response: - body: - string: '{"status":"Succeeded"}' - headers: - cache-control: - - no-cache - content-length: - - '22' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:41 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND?api-version=2018-01-22 - response: - body: - string: '{"etag":"AAAAAALwwXo=","name":"myProvisioningServiceRND","location":"East - US","properties":{"state":"Active","provisioningState":"Succeeded","iotHubs":[],"allocationPolicy":"Hashed","serviceOperationsHostName":"myProvisioningServiceRND.azure-devices-provisioning.net","deviceProvisioningHostName":"global.azure-devices-provisioning.net","idScope":"0ne000F9208"},"resourcegroup":"test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44","type":"Microsoft.Devices/provisioningServices","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND","subscriptionid":"00000000-0000-0000-0000-000000000000","tags":{},"sku":{"name":"S1","tier":"Standard","capacity":1}}' - headers: - cache-control: - - no-cache - content-length: - - '855' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:46 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - accept-language: - - en-US - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND/certificates?api-version=2018-01-22 - response: - body: - string: '{"value":[]}' - headers: - cache-control: - - no-cache - content-length: - - '12' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:46 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - accept-language: - - en-US - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND?api-version=2018-01-22 - response: - body: - string: '{"etag":"AAAAAALwwXo=","name":"myProvisioningServiceRND","location":"East - US","properties":{"state":"Active","provisioningState":"Succeeded","iotHubs":[],"allocationPolicy":"Hashed","serviceOperationsHostName":"myProvisioningServiceRND.azure-devices-provisioning.net","deviceProvisioningHostName":"global.azure-devices-provisioning.net","idScope":"0ne000F9208"},"resourcegroup":"test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44","type":"Microsoft.Devices/provisioningServices","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND","subscriptionid":"00000000-0000-0000-0000-000000000000","tags":{},"sku":{"name":"S1","tier":"Standard","capacity":1}}' - headers: - cache-control: - - no-cache - content-length: - - '855' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:47 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '2' - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - accept-language: - - en-US - method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND?api-version=2018-01-22 - response: - body: - string: '{"etag":"","name":"myProvisioningServiceRND","location":"East US","properties":{"state":"Active","provisioningState":"Succeeded","iotHubs":[],"allocationPolicy":"Hashed","serviceOperationsHostName":"myProvisioningServiceRND.azure-devices-provisioning.net","deviceProvisioningHostName":"global.azure-devices-provisioning.net","idScope":"0ne000F9208"},"resourcegroup":"test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44","type":"Microsoft.Devices/provisioningServices","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND","subscriptionid":"00000000-0000-0000-0000-000000000000","tags":{},"sku":{"name":"S1","tier":"Standard","capacity":1}}' - headers: - cache-control: - - no-cache - content-length: - - '843' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:49 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '4999' - status: - code: 200 - message: OK -- request: - body: '{"name": "test213123"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '22' - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - accept-language: - - en-US - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2018-01-22 - response: - body: - string: '{"nameAvailable":true,"reason":"Invalid","message":null}' - headers: - cache-control: - - no-cache - content-length: - - '56' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:49 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - accept-language: - - en-US - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND?api-version=2018-01-22 - response: - body: - string: 'null' - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND/operationResults/b3NfaWRfNTk5NjE4ZjUtY2Q1Yy00ZTUwLTlmMDEtNTljOGFjNDdmMzlm?api-version=2018-01-22&asyncinfo - cache-control: - - no-cache - content-length: - - '4' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:17:51 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND/operationResults/b3NfaWRfNTk5NjE4ZjUtY2Q1Yy00ZTUwLTlmMDEtNTljOGFjNDdmMzlm?api-version=2018-01-22 - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14998' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-iothubprovisioningservices/0.2.0 Azure-SDK-For-Python - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_iothubprovisioningservices_test_iothubprovisioningservices4ed01e44/providers/Microsoft.Devices/provisioningServices/myProvisioningServiceRND/operationResults/b3NfaWRfNTk5NjE4ZjUtY2Q1Yy00ZTUwLTlmMDEtNTljOGFjNDdmMzlm?api-version=2018-01-22&asyncinfo - response: - body: - string: '{"status":"Succeeded"}' - headers: - cache-control: - - no-cache - content-length: - - '22' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 01 May 2020 20:18:07 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -version: 1 diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/tests/test_cli_mgmt_iothubprovisioningservices.py b/sdk/iothub/azure-mgmt-iothubprovisioningservices/tests/test_cli_mgmt_iothubprovisioningservices.py index 648f7ae8127b..3b84946304f1 100644 --- a/sdk/iothub/azure-mgmt-iothubprovisioningservices/tests/test_cli_mgmt_iothubprovisioningservices.py +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/tests/test_cli_mgmt_iothubprovisioningservices.py @@ -31,6 +31,7 @@ def setUp(self): azure.mgmt.iothubprovisioningservices.IotDpsClient ) + @unittest.skip('hard to test') @ResourceGroupPreparer(location=AZURE_LOCATION) def test_iothubprovisioningservices(self, resource_group): diff --git a/sdk/iothub/ci.yml b/sdk/iothub/ci.yml index 8536bff041f6..6593a6baf191 100644 --- a/sdk/iothub/ci.yml +++ b/sdk/iothub/ci.yml @@ -32,3 +32,5 @@ extends: Artifacts: - name: azure-mgmt-iothub safeName: azuremgmtiothub + - name: azure-mgmt-iothubprovisioningservices + safeName: azuremgmtiothubprovisioningservices diff --git a/shared_requirements.txt b/shared_requirements.txt index 35329bcb24bd..70a08ee5b466 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -275,6 +275,7 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-storagecache msrest>=0.6.21 #override azure-mgmt-videoanalyzer msrest>=0.6.21 #override azure-mgmt-extendedlocation msrest>=0.6.21 +#override azure-mgmt-iothubprovisioningservices msrest>=0.6.21 #override azure-mgmt-recoveryservicesbackup msrest>=0.6.21 #override azure-mgmt-network msrest>=0.6.21 #override azure-mgmt-iothub msrest>=0.6.21 @@ -282,4 +283,5 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-sql msrest>=0.6.21 #override azure-agrifood-farming azure-core<2.0.0,>=1.8.2 #override azure-agrifood-farming msrest>=0.6.21 +#override azure-agrifood-farming msrest>=0.6.21 #override azure-mgmt-agfood msrest>=0.6.21