diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/__init__.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/__init__.py new file mode 100644 index 000000000000..908617c53e25 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/__init__.py @@ -0,0 +1,18 @@ +# 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 +from .version import VERSION + +__all__ = ['IotDpsClient'] + +__version__ = VERSION + diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/iot_dps_client.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/iot_dps_client.py new file mode 100644 index 000000000000..bd6c092d81de --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/iot_dps_client.py @@ -0,0 +1,91 @@ +# 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 SDKClient +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(SDKClient): + """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) + super(IotDpsClient, self).__init__(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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/__init__.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/__init__.py new file mode 100644 index 000000000000..6bfa525ee9ab --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/__init__.py @@ -0,0 +1,104 @@ +# 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. +# -------------------------------------------------------------------------- + +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 +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, + AccessRightsDescription, + NameUnavailabilityReason, + CertificatePurpose, +) + +__all__ = [ + 'ErrorMesssage', + 'AsyncOperationResult', + 'CertificateProperties', + 'CertificateResponse', + 'CertificateListDescription', + 'CertificateBodyDescription', + 'IotDpsSkuInfo', + 'IotHubDefinitionDescription', + 'SharedAccessSignatureAuthorizationRuleAccessRightsDescription', + 'IotDpsPropertiesDescription', + 'ProvisioningServiceDescription', + 'Resource', + 'OperationDisplay', + 'Operation', + 'ErrorDetails', 'ErrorDetailsException', + 'IotDpsSkuDefinition', + 'OperationInputs', + 'NameAvailabilityInfo', + 'TagsResource', + 'VerificationCodeResponseProperties', + 'VerificationCodeResponse', + 'VerificationCodeRequest', + 'OperationPaged', + 'ProvisioningServiceDescriptionPaged', + 'IotDpsSkuDefinitionPaged', + 'SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionPaged', + 'IotDpsSku', + 'State', + 'AllocationPolicy', + 'AccessRightsDescription', + 'NameUnavailabilityReason', + 'CertificatePurpose', +] diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result.py new file mode 100644 index 000000000000..d220a92098f5 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result.py @@ -0,0 +1,32 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result_py3.py new file mode 100644 index 000000000000..d4365e11a55b --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/async_operation_result_py3.py @@ -0,0 +1,32 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description.py new file mode 100644 index 000000000000..a35e4c3fa2dd --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description_py3.py new file mode 100644 index 000000000000..0383312e8b38 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_body_description_py3.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description.py new file mode 100644 index 000000000000..e48e46d87abc --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description_py3.py new file mode 100644 index 000000000000..3c86d0ce38e6 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_list_description_py3.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties.py new file mode 100644 index 000000000000..d38a4e83a28c --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties.py @@ -0,0 +1,60 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties_py3.py new file mode 100644 index 000000000000..c7bdf10c5550 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_properties_py3.py @@ -0,0 +1,60 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response.py new file mode 100644 index 000000000000..6a4ff8db3d87 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response.py @@ -0,0 +1,55 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response_py3.py new file mode 100644 index 000000000000..a551bc58c285 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/certificate_response_py3.py @@ -0,0 +1,55 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details.py new file mode 100644 index 000000000000..77a408028562 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details.py @@ -0,0 +1,63 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details_py3.py new file mode 100644 index 000000000000..a78684fab905 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_details_py3.py @@ -0,0 +1,63 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage.py new file mode 100644 index 000000000000..ecec0bf5636a --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage.py @@ -0,0 +1,36 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage_py3.py new file mode 100644 index 000000000000..c430f625fe45 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/error_messsage_py3.py @@ -0,0 +1,36 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_client_enums.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_client_enums.py new file mode 100644 index 000000000000..dd0012dda30c --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_client_enums.py @@ -0,0 +1,62 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description.py new file mode 100644 index 000000000000..cbc029e21114 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description.py @@ -0,0 +1,80 @@ +# 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 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 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'}, + '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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description_py3.py new file mode 100644 index 000000000000..eeb34347ad5f --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_properties_description_py3.py @@ -0,0 +1,80 @@ +# 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 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 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'}, + '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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition.py new file mode 100644 index 000000000000..89d112ceb092 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition.py @@ -0,0 +1,28 @@ +# 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 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) diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_paged.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_paged.py new file mode 100644 index 000000000000..981f1fb2599a --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_paged.py @@ -0,0 +1,27 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_py3.py new file mode 100644 index 000000000000..30b234ae6c98 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_definition_py3.py @@ -0,0 +1,28 @@ +# 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 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=None, **kwargs) -> None: + super(IotDpsSkuDefinition, self).__init__(**kwargs) + self.name = name diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info.py new file mode 100644 index 000000000000..eab2f28be528 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info.py @@ -0,0 +1,43 @@ +# 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 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) diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info_py3.py new file mode 100644 index 000000000000..8fe063625aae --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_dps_sku_info_py3.py @@ -0,0 +1,43 @@ +# 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 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=None, capacity: int=None, **kwargs) -> None: + super(IotDpsSkuInfo, self).__init__(**kwargs) + self.name = name + self.tier = None + self.capacity = capacity diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description.py new file mode 100644 index 000000000000..a5ec8e232bf0 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description.py @@ -0,0 +1,56 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description_py3.py new file mode 100644 index 000000000000..939dcf435091 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/iot_hub_definition_description_py3.py @@ -0,0 +1,56 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info.py new file mode 100644 index 000000000000..2984608d647f --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info.py @@ -0,0 +1,38 @@ +# 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 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) diff --git a/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info_py3.py new file mode 100644 index 000000000000..c247bd0e0e2a --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/name_availability_info_py3.py @@ -0,0 +1,38 @@ +# 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 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: 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation.py new file mode 100644 index 000000000000..6ef6ac9cb76e --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation.py @@ -0,0 +1,41 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display.py new file mode 100644 index 000000000000..d198f80a81c1 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display.py @@ -0,0 +1,45 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display_py3.py new file mode 100644 index 000000000000..a1add8843a0a --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_display_py3.py @@ -0,0 +1,45 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs.py new file mode 100644 index 000000000000..09ee8b535542 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs.py @@ -0,0 +1,34 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs_py3.py new file mode 100644 index 000000000000..f0e2e45af4f7 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_inputs_py3.py @@ -0,0 +1,34 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_paged.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_paged.py new file mode 100644 index 000000000000..3f6c7fbeb755 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_paged.py @@ -0,0 +1,27 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_py3.py new file mode 100644 index 000000000000..e25e19d1f294 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/operation_py3.py @@ -0,0 +1,41 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description.py new file mode 100644 index 000000000000..1cb1ca6d0178 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description.py @@ -0,0 +1,69 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_paged.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_paged.py new file mode 100644 index 000000000000..3f10e4fdb0d5 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_paged.py @@ -0,0 +1,27 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_py3.py new file mode 100644 index 000000000000..3c9416dc2eb3 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/provisioning_service_description_py3.py @@ -0,0 +1,69 @@ +# 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_py3 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource.py new file mode 100644 index 000000000000..e03d78711115 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource.py @@ -0,0 +1,56 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource_py3.py new file mode 100644 index 000000000000..436710184586 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/resource_py3.py @@ -0,0 +1,56 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description.py new file mode 100644 index 000000000000..d89bb6c46acf --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description.py @@ -0,0 +1,50 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_paged.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_paged.py new file mode 100644 index 000000000000..3223713a25e7 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_paged.py @@ -0,0 +1,27 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_py3.py new file mode 100644 index 000000000000..36235ef85249 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/shared_access_signature_authorization_rule_access_rights_description_py3.py @@ -0,0 +1,50 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource.py new file mode 100644 index 000000000000..16f684053142 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource_py3.py new file mode 100644 index 000000000000..5afbce93d8c0 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/tags_resource_py3.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request.py new file mode 100644 index 000000000000..1602cc58f886 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request_py3.py new file mode 100644 index 000000000000..058544415d4b --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_request_py3.py @@ -0,0 +1,29 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response.py new file mode 100644 index 000000000000..39d2ae14a87f --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response.py @@ -0,0 +1,55 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties.py new file mode 100644 index 000000000000..db5b81439493 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties.py @@ -0,0 +1,53 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties_py3.py new file mode 100644 index 000000000000..ed93c35fb395 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_properties_py3.py @@ -0,0 +1,53 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_py3.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_py3.py new file mode 100644 index 000000000000..bf0ead104a47 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response_py3.py @@ -0,0 +1,55 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/__init__.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/__init__.py new file mode 100644 index 000000000000..fb15e05ea1bd --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/__init__.py @@ -0,0 +1,20 @@ +# 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/dps_certificate_operations.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/dps_certificate_operations.py new file mode 100644 index 000000000000..e8e296fa6477 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/dps_certificate_operations.py @@ -0,0 +1,583 @@ +# 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters, body_content) + response = self._client.send(request, 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 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 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 = {} + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters, body_content) + response = self._client.send(request, 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/iot_dps_resource_operations.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/iot_dps_resource_operations.py new file mode 100644 index 000000000000..2fe07692be4f --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/iot_dps_resource_operations.py @@ -0,0 +1,887 @@ +# 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters, body_content) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters, body_content) + response = self._client.send(request, 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 = {} + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters, body_content) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/operations.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/operations.py new file mode 100644 index 000000000000..1d104862942d --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/operations/operations.py @@ -0,0 +1,96 @@ +# 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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/version.py b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/version.py new file mode 100644 index 000000000000..d383aa0490a9 --- /dev/null +++ b/sdk/azure-mgmt-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2018-01-22" +