diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/__init__.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/__init__.py new file mode 100644 index 000000000000..aa0b81062fe5 --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import DeviceServicesConfiguration +from ._device_services import DeviceServices +__all__ = ['DeviceServices', 'DeviceServicesConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/_configuration.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/_configuration.py new file mode 100644 index 000000000000..4628818a96aa --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/_configuration.py @@ -0,0 +1,48 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class DeviceServicesConfiguration(AzureConfiguration): + """Configuration for DeviceServices + 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(DeviceServicesConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-windowsiot/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/_device_services.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/_device_services.py new file mode 100644 index 000000000000..fcea709fe8ec --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/_device_services.py @@ -0,0 +1,54 @@ +# 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 ._configuration import DeviceServicesConfiguration +from .operations import Operations +from .operations import ServicesOperations +from . import models + + +class DeviceServices(SDKClient): + """Use this API to manage the Windows IoT device services in your Azure subscription. + + :ivar config: Configuration for client. + :vartype config: DeviceServicesConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.windowsiot.operations.Operations + :ivar services: Services operations + :vartype services: azure.mgmt.windowsiot.operations.ServicesOperations + + :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 = DeviceServicesConfiguration(credentials, subscription_id, base_url) + super(DeviceServices, 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 = '2019-06-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.services = ServicesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/__init__.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/__init__.py new file mode 100644 index 000000000000..4f971c6d4519 --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/__init__.py @@ -0,0 +1,54 @@ +# 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 ._models_py3 import DeviceService + from ._models_py3 import DeviceServiceCheckNameAvailabilityParameters + from ._models_py3 import DeviceServiceNameAvailabilityInfo + from ._models_py3 import ErrorDetails, ErrorDetailsException + from ._models_py3 import ErrorDetailsError + from ._models_py3 import OperationDisplayInfo + from ._models_py3 import OperationEntity + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import DeviceService + from ._models import DeviceServiceCheckNameAvailabilityParameters + from ._models import DeviceServiceNameAvailabilityInfo + from ._models import ErrorDetails, ErrorDetailsException + from ._models import ErrorDetailsError + from ._models import OperationDisplayInfo + from ._models import OperationEntity + from ._models import ProxyResource + from ._models import Resource + from ._models import TrackedResource +from ._paged_models import DeviceServicePaged +from ._paged_models import OperationEntityPaged +from ._device_services_enums import ( + ServiceNameUnavailabilityReason, +) + +__all__ = [ + 'DeviceService', + 'DeviceServiceCheckNameAvailabilityParameters', + 'DeviceServiceNameAvailabilityInfo', + 'ErrorDetails', 'ErrorDetailsException', + 'ErrorDetailsError', + 'OperationDisplayInfo', + 'OperationEntity', + 'ProxyResource', + 'Resource', + 'TrackedResource', + 'OperationEntityPaged', + 'DeviceServicePaged', + 'ServiceNameUnavailabilityReason', +] diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_device_services_enums.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_device_services_enums.py new file mode 100644 index 000000000000..6ca58aa48cd3 --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_device_services_enums.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 enum import Enum + + +class ServiceNameUnavailabilityReason(str, Enum): + + invalid = "Invalid" + already_exists = "AlreadyExists" diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_models.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_models.py new file mode 100644 index 000000000000..9a2d0399f9a4 --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_models.py @@ -0,0 +1,358 @@ +# 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 CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Resource(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + + +class DeviceService(TrackedResource): + """The description of the Windows IoT Device Service. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives + :type location: 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 notes: Windows IoT Device Service notes. + :type notes: str + :ivar start_date: Windows IoT Device Service start date, + :vartype start_date: datetime + :param quantity: Windows IoT Device Service device allocation, + :type quantity: long + :param billing_domain_name: Windows IoT Device Service ODM AAD domain + :type billing_domain_name: str + :param admin_domain_name: Windows IoT Device Service OEM AAD domain + :type admin_domain_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'start_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, + 'start_date': {'key': 'properties.startDate', 'type': 'iso-8601'}, + 'quantity': {'key': 'properties.quantity', 'type': 'long'}, + 'billing_domain_name': {'key': 'properties.billingDomainName', 'type': 'str'}, + 'admin_domain_name': {'key': 'properties.adminDomainName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeviceService, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.notes = kwargs.get('notes', None) + self.start_date = None + self.quantity = kwargs.get('quantity', None) + self.billing_domain_name = kwargs.get('billing_domain_name', None) + self.admin_domain_name = kwargs.get('admin_domain_name', None) + + +class DeviceServiceCheckNameAvailabilityParameters(Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Windows IoT Device Service to + check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeviceServiceCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class DeviceServiceNameAvailabilityInfo(Model): + """The properties indicating whether a given Windows IoT Device Service name + is available. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name_available: The value which indicates whether the provided name + is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: + 'Invalid', 'AlreadyExists' + :vartype reason: str or + ~azure.mgmt.windowsiot.models.ServiceNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'ServiceNameUnavailabilityReason'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeviceServiceNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = kwargs.get('message', None) + + +class ErrorDetails(Model): + """The details of the error. + + :param error: The error object. + :type error: ~azure.mgmt.windowsiot.models.ErrorDetailsError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetailsError'}, + } + + def __init__(self, **kwargs): + super(ErrorDetails, self).__init__(**kwargs) + self.error = kwargs.get('error', 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) + + +class ErrorDetailsError(Model): + """The error object. + + :param code: One of a server-defined set of error codes. + :type code: str + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the particular error. + :type target: str + :param details: A human-readable representation of the error's details. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDetailsError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class OperationDisplayInfo(Model): + """The operation supported by Azure Data Catalog Service. + + :param description: The description of the operation. + :type description: str + :param operation: The action that users can perform, based on their + permission level. + :type operation: str + :param provider: Service provider: Azure Data Catalog Service. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplayInfo, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.operation = kwargs.get('operation', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + + +class OperationEntity(Model): + """The operation supported by Azure Data Catalog Service. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The operation supported by Azure Data Catalog Service. + :type display: ~azure.mgmt.windowsiot.models.OperationDisplayInfo + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param origin: Indicates the executor of the operation. + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationEntity, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.origin = kwargs.get('origin', None) + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_models_py3.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_models_py3.py new file mode 100644 index 000000000000..fe37c977efe5 --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_models_py3.py @@ -0,0 +1,358 @@ +# 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 CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Resource(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, tags=None, location: str=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class DeviceService(TrackedResource): + """The description of the Windows IoT Device Service. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives + :type location: 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 notes: Windows IoT Device Service notes. + :type notes: str + :ivar start_date: Windows IoT Device Service start date, + :vartype start_date: datetime + :param quantity: Windows IoT Device Service device allocation, + :type quantity: long + :param billing_domain_name: Windows IoT Device Service ODM AAD domain + :type billing_domain_name: str + :param admin_domain_name: Windows IoT Device Service OEM AAD domain + :type admin_domain_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'start_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, + 'start_date': {'key': 'properties.startDate', 'type': 'iso-8601'}, + 'quantity': {'key': 'properties.quantity', 'type': 'long'}, + 'billing_domain_name': {'key': 'properties.billingDomainName', 'type': 'str'}, + 'admin_domain_name': {'key': 'properties.adminDomainName', 'type': 'str'}, + } + + def __init__(self, *, tags=None, location: str=None, etag: str=None, notes: str=None, quantity: int=None, billing_domain_name: str=None, admin_domain_name: str=None, **kwargs) -> None: + super(DeviceService, self).__init__(tags=tags, location=location, **kwargs) + self.etag = etag + self.notes = notes + self.start_date = None + self.quantity = quantity + self.billing_domain_name = billing_domain_name + self.admin_domain_name = admin_domain_name + + +class DeviceServiceCheckNameAvailabilityParameters(Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the Windows IoT Device 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(DeviceServiceCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + + +class DeviceServiceNameAvailabilityInfo(Model): + """The properties indicating whether a given Windows IoT Device Service name + is available. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name_available: The value which indicates whether the provided name + is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: + 'Invalid', 'AlreadyExists' + :vartype reason: str or + ~azure.mgmt.windowsiot.models.ServiceNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'ServiceNameUnavailabilityReason'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, message: str=None, **kwargs) -> None: + super(DeviceServiceNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = message + + +class ErrorDetails(Model): + """The details of the error. + + :param error: The error object. + :type error: ~azure.mgmt.windowsiot.models.ErrorDetailsError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetailsError'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorDetails, self).__init__(**kwargs) + self.error = error + + +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) + + +class ErrorDetailsError(Model): + """The error object. + + :param code: One of a server-defined set of error codes. + :type code: str + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the particular error. + :type target: str + :param details: A human-readable representation of the error's details. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, details: str=None, **kwargs) -> None: + super(ErrorDetailsError, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class OperationDisplayInfo(Model): + """The operation supported by Azure Data Catalog Service. + + :param description: The description of the operation. + :type description: str + :param operation: The action that users can perform, based on their + permission level. + :type operation: str + :param provider: Service provider: Azure Data Catalog Service. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__(self, *, description: str=None, operation: str=None, provider: str=None, resource: str=None, **kwargs) -> None: + super(OperationDisplayInfo, self).__init__(**kwargs) + self.description = description + self.operation = operation + self.provider = provider + self.resource = resource + + +class OperationEntity(Model): + """The operation supported by Azure Data Catalog Service. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The operation supported by Azure Data Catalog Service. + :type display: ~azure.mgmt.windowsiot.models.OperationDisplayInfo + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param origin: Indicates the executor of the operation. + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, display=None, is_data_action: bool=None, origin: str=None, **kwargs) -> None: + super(OperationEntity, self).__init__(**kwargs) + self.name = name + self.display = display + self.is_data_action = is_data_action + self.origin = origin + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_paged_models.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_paged_models.py new file mode 100644 index 000000000000..e79cb3b41d8f --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/models/_paged_models.py @@ -0,0 +1,40 @@ +# 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 OperationEntityPaged(Paged): + """ + A paging container for iterating over a list of :class:`OperationEntity ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[OperationEntity]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationEntityPaged, self).__init__(*args, **kwargs) +class DeviceServicePaged(Paged): + """ + A paging container for iterating over a list of :class:`DeviceService ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DeviceService]'} + } + + def __init__(self, *args, **kwargs): + + super(DeviceServicePaged, self).__init__(*args, **kwargs) diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/__init__.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/__init__.py new file mode 100644 index 000000000000..b50ed1eb5155 --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/__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 ._operations import Operations +from ._services_operations import ServicesOperations + +__all__ = [ + 'Operations', + 'ServicesOperations', +] diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/_operations.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/_operations.py new file mode 100644 index 000000000000..88334ad89f3b --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/_operations.py @@ -0,0 +1,100 @@ +# 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. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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: "2019-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Windows IoT Services 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 OperationEntity + :rtype: + ~azure.mgmt.windowsiot.models.OperationEntityPaged[~azure.mgmt.windowsiot.models.OperationEntity] + :raises: + :class:`ErrorDetailsException` + """ + def prepare_request(next_link=None): + 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationEntityPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.WindowsIoT/operations'} diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/_services_operations.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/_services_operations.py new file mode 100644 index 000000000000..da8c2eceb932 --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/operations/_services_operations.py @@ -0,0 +1,522 @@ +# 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 ServicesOperations(object): + """ServicesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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: "2019-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01" + + self.config = config + + def get( + self, resource_group_name, device_name, custom_headers=None, raw=False, **operation_config): + """Get the non-security related metadata of a Windows IoT Device Service. + + :param resource_group_name: The name of the resource group that + contains the Windows IoT Device Service. + :type resource_group_name: str + :param device_name: The name of the Windows IoT Device Service. + :type device_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: DeviceService or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.windowsiot.models.DeviceService or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDetailsException` + """ + # Construct URL + url = self.get.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'), + 'deviceName': self._serialize.url("device_name", device_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('DeviceService', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}'} + + def create_or_update( + self, resource_group_name, device_name, device_service, if_match=None, custom_headers=None, raw=False, **operation_config): + """Create or update the metadata of a Windows IoT Device Service. + + Create or update the metadata of a Windows IoT Device Service. The + usual pattern to modify a property is to retrieve the Windows IoT + Device Service metadata and security metadata, and then combine them + with the modified values in a new body to update the Windows IoT Device + Service. + + :param resource_group_name: The name of the resource group that + contains the Windows IoT Device Service. + :type resource_group_name: str + :param device_name: The name of the Windows IoT Device Service. + :type device_name: str + :param device_service: The Windows IoT Device Service metadata and + security metadata. + :type device_service: ~azure.mgmt.windowsiot.models.DeviceService + :param if_match: ETag of the Windows IoT Device Service. Do not + specify for creating a new Windows IoT Device Service. Required to + update an existing Windows IoT Device Service. + :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: DeviceService or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.windowsiot.models.DeviceService or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDetailsException` + """ + # 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'), + 'deviceName': self._serialize.url("device_name", device_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 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(device_service, 'DeviceService') + + # 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('DeviceService', response) + if response.status_code == 201: + deserialized = self._deserialize('DeviceService', 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.WindowsIoT/deviceServices/{deviceName}'} + + def update( + self, resource_group_name, device_name, device_service, if_match=None, custom_headers=None, raw=False, **operation_config): + """Updates the metadata of a Windows IoT Device Service. + + Updates the metadata of a Windows IoT Device Service. The usual pattern + to modify a property is to retrieve the Windows IoT Device Service + metadata and security metadata, and then combine them with the modified + values in a new body to update the Windows IoT Device Service. + + :param resource_group_name: The name of the resource group that + contains the Windows IoT Device Service. + :type resource_group_name: str + :param device_name: The name of the Windows IoT Device Service. + :type device_name: str + :param device_service: The Windows IoT Device Service metadata and + security metadata. + :type device_service: ~azure.mgmt.windowsiot.models.DeviceService + :param if_match: ETag of the Windows IoT Device Service. Do not + specify for creating a brand new Windows IoT Device Service. Required + to update an existing Windows IoT Device Service. + :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: DeviceService or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.windowsiot.models.DeviceService or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDetailsException` + """ + # 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'), + 'deviceName': self._serialize.url("device_name", device_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 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(device_service, 'DeviceService') + + # 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]: + raise models.ErrorDetailsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeviceService', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}'} + + def delete( + self, resource_group_name, device_name, custom_headers=None, raw=False, **operation_config): + """Delete a Windows IoT Device Service. + + :param resource_group_name: The name of the resource group that + contains the Windows IoT Device Service. + :type resource_group_name: str + :param device_name: The name of the Windows IoT Device Service. + :type device_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: DeviceService or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.windowsiot.models.DeviceService 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'), + 'deviceName': self._serialize.url("device_name", device_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.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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeviceService', response) + if response.status_code == 204: + deserialized = self._deserialize('DeviceService', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that + contains the Windows IoT Device 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: An iterator like instance of DeviceService + :rtype: + ~azure.mgmt.windowsiot.models.DeviceServicePaged[~azure.mgmt.windowsiot.models.DeviceService] + :raises: + :class:`ErrorDetailsException` + """ + def prepare_request(next_link=None): + 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeviceServicePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get all the IoT hubs in a subscription. + + :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 DeviceService + :rtype: + ~azure.mgmt.windowsiot.models.DeviceServicePaged[~azure.mgmt.windowsiot.models.DeviceService] + :raises: + :class:`ErrorDetailsException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeviceServicePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/deviceServices'} + + def check_device_service_name_availability( + self, name, custom_headers=None, raw=False, **operation_config): + """Check if a Windows IoT Device Service name is available. + + :param name: The name of the Windows IoT Device 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: DeviceServiceNameAvailabilityInfo or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.windowsiot.models.DeviceServiceNameAvailabilityInfo or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDetailsException` + """ + device_service_check_name_availability_parameters = models.DeviceServiceCheckNameAvailabilityParameters(name=name) + + # Construct URL + url = self.check_device_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(device_service_check_name_availability_parameters, 'DeviceServiceCheckNameAvailabilityParameters') + + # 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('DeviceServiceNameAvailabilityInfo', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_device_service_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/checkDeviceServiceNameAvailability'} diff --git a/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/version.py b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/version.py new file mode 100644 index 000000000000..e0ec669828cb --- /dev/null +++ b/sdk/azure-mgmt-windowsiot/azure/mgmt/windowsiot/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 = "0.1.0" +