From 06c7c2682a8f70cf53628e771cbb41cb6c2869c3 Mon Sep 17 00:00:00 2001 From: changlong-liu <59815250+changlong-liu@users.noreply.github.com> Date: Thu, 22 Oct 2020 09:32:18 +0800 Subject: [PATCH] Sdk automation/azure mgmt digitaltwins (#14004) * Generated from d6b938a5f2b08364f6cc54cea59eb660714892c7 * multiapi * changelog * regenerate Co-authored-by: SDK Automation --- .../azure-mgmt-digitaltwins/CHANGELOG.md | 4 + .../_azure_digital_twins_management_client.py | 129 +++- .../azure/mgmt/digitaltwins/models.py | 7 + .../v2020_03_01_preview/__init__.py | 19 + .../_azure_digital_twins_management_client.py | 59 ++ .../v2020_03_01_preview/_configuration.py | 48 ++ .../models/__init__.py | 0 ...e_digital_twins_management_client_enums.py | 0 .../models/_models.py | 46 +- .../models/_models_py3.py | 46 +- .../models/_paged_models.py | 0 .../operations/__init__.py | 0 .../_digital_twins_endpoint_operations.py | 0 .../operations/_digital_twins_operations.py | 0 .../operations/_operations.py | 0 .../v2020_03_01_preview/version.py | 13 + .../mgmt/digitaltwins/v2020_10_31/__init__.py | 19 + .../_azure_digital_twins_management_client.py | 59 ++ .../v2020_10_31/_configuration.py | 48 ++ .../v2020_10_31/models/__init__.py | 75 +++ ...e_digital_twins_management_client_enums.py | 47 ++ .../v2020_10_31/models/_models.py | 626 ++++++++++++++++++ .../v2020_10_31/models/_models_py3.py | 626 ++++++++++++++++++ .../v2020_10_31/models/_paged_models.py | 53 ++ .../v2020_10_31/operations/__init__.py | 20 + .../_digital_twins_endpoint_operations.py | 387 +++++++++++ .../operations/_digital_twins_operations.py | 575 ++++++++++++++++ .../v2020_10_31/operations/_operations.py | 100 +++ .../mgmt/digitaltwins/v2020_10_31/version.py | 13 + .../azure/mgmt/digitaltwins/version.py | 3 +- 30 files changed, 2946 insertions(+), 76 deletions(-) create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/__init__.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_configuration.py rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/models/__init__.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/models/_azure_digital_twins_management_client_enums.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/models/_models.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/models/_models_py3.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/models/_paged_models.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/operations/__init__.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/operations/_digital_twins_endpoint_operations.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/operations/_digital_twins_operations.py (100%) rename sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/{ => v2020_03_01_preview}/operations/_operations.py (100%) create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/version.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/__init__.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_configuration.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/__init__.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_azure_digital_twins_management_client_enums.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models_py3.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_paged_models.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/__init__.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_operations.py create mode 100644 sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/version.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md b/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md index e6b13e367a1..902455d0c2a 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.0 (2020-09-24) + +* Release as Multi-API package. + ## 0.1.0 (2020-05-31) * Initial Release diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_azure_digital_twins_management_client.py index 3cbd4b433d7..e35915ad65b 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_azure_digital_twins_management_client.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/_azure_digital_twins_management_client.py @@ -12,48 +12,121 @@ from msrest.service_client import SDKClient from msrest import Serializer, Deserializer +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import AzureDigitalTwinsManagementClientConfiguration -from .operations import DigitalTwinsOperations -from .operations import DigitalTwinsEndpointOperations -from .operations import Operations -from . import models -class AzureDigitalTwinsManagementClient(SDKClient): + +class AzureDigitalTwinsManagementClient(MultiApiClientMixin, SDKClient): """Azure Digital Twins Client for managing DigitalTwinsInstance + This ready contains multiple API versions, to help you deal with all Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, uses latest API version available on public Azure. + For production, you should stick a particular api-version and/or profile. + The profile sets a mapping between the operation group and an API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + :ivar config: Configuration for client. :vartype config: AzureDigitalTwinsManagementClientConfiguration - :ivar digital_twins: DigitalTwins operations - :vartype digital_twins: azure.mgmt.digitaltwins.operations.DigitalTwinsOperations - :ivar digital_twins_endpoint: DigitalTwinsEndpoint operations - :vartype digital_twins_endpoint: azure.mgmt.digitaltwins.operations.DigitalTwinsEndpointOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.digitaltwins.operations.Operations - :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials object` - :param subscription_id: The subscription identifier. + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. :type subscription_id: str + :param str api_version: API version to use if no profile is provided, or if + missing in profile. :param str base_url: Service URL + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles """ - def __init__( - self, credentials, subscription_id, base_url=None): + DEFAULT_API_VERSION = '2020-10-31' + _PROFILE_TAG = "azure.mgmt.digitaltwins.AzureDigitalTwinsManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): self.config = AzureDigitalTwinsManagementClientConfiguration(credentials, subscription_id, base_url) - super(AzureDigitalTwinsManagementClient, 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 = '2020-03-01-preview' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.digital_twins = DigitalTwinsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.digital_twins_endpoint = DigitalTwinsEndpointOperations( - self._client, self.config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + super(AzureDigitalTwinsManagementClient, self).__init__( + credentials, + self.config, + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2020-03-01-preview: :mod:`v2020_03_01_preview.models` + * 2020-10-31: :mod:`v2020_10_31.models` + """ + if api_version == '2020-03-01-preview': + from .v2020_03_01_preview import models + return models + elif api_version == '2020-10-31': + from .v2020_10_31 import models + return models + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + + @property + def digital_twins(self): + """Instance depends on the API version: + + * 2020-03-01-preview: :class:`DigitalTwinsOperations` + * 2020-10-31: :class:`DigitalTwinsOperations` + """ + api_version = self._get_api_version('digital_twins') + if api_version == '2020-03-01-preview': + from .v2020_03_01_preview.operations import DigitalTwinsOperations as OperationClass + elif api_version == '2020-10-31': + from .v2020_10_31.operations import DigitalTwinsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def digital_twins_endpoint(self): + """Instance depends on the API version: + + * 2020-03-01-preview: :class:`DigitalTwinsEndpointOperations` + * 2020-10-31: :class:`DigitalTwinsEndpointOperations` + """ + api_version = self._get_api_version('digital_twins_endpoint') + if api_version == '2020-03-01-preview': + from .v2020_03_01_preview.operations import DigitalTwinsEndpointOperations as OperationClass + elif api_version == '2020-10-31': + from .v2020_10_31.operations import DigitalTwinsEndpointOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: + + * 2020-03-01-preview: :class:`Operations` + * 2020-10-31: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2020-03-01-preview': + from .v2020_03_01_preview.operations import Operations as OperationClass + elif api_version == '2020-10-31': + from .v2020_10_31.operations import Operations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models.py new file mode 100644 index 00000000000..2520b4c9c2d --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models.py @@ -0,0 +1,7 @@ +# 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. +# -------------------------------------------------------------------------- +from .v2020_10_31.models import * diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/__init__.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/__init__.py new file mode 100644 index 00000000000..29751a31716 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/__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 AzureDigitalTwinsManagementClientConfiguration +from ._azure_digital_twins_management_client import AzureDigitalTwinsManagementClient +__all__ = ['AzureDigitalTwinsManagementClient', 'AzureDigitalTwinsManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py new file mode 100644 index 00000000000..3cbd4b433d7 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_azure_digital_twins_management_client.py @@ -0,0 +1,59 @@ +# 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 AzureDigitalTwinsManagementClientConfiguration +from .operations import DigitalTwinsOperations +from .operations import DigitalTwinsEndpointOperations +from .operations import Operations +from . import models + + +class AzureDigitalTwinsManagementClient(SDKClient): + """Azure Digital Twins Client for managing DigitalTwinsInstance + + :ivar config: Configuration for client. + :vartype config: AzureDigitalTwinsManagementClientConfiguration + + :ivar digital_twins: DigitalTwins operations + :vartype digital_twins: azure.mgmt.digitaltwins.operations.DigitalTwinsOperations + :ivar digital_twins_endpoint: DigitalTwinsEndpoint operations + :vartype digital_twins_endpoint: azure.mgmt.digitaltwins.operations.DigitalTwinsEndpointOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.digitaltwins.operations.Operations + + :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 = AzureDigitalTwinsManagementClientConfiguration(credentials, subscription_id, base_url) + super(AzureDigitalTwinsManagementClient, 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 = '2020-03-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.digital_twins = DigitalTwinsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.digital_twins_endpoint = DigitalTwinsEndpointOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_configuration.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_configuration.py new file mode 100644 index 00000000000..011639f40f2 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/_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 AzureDigitalTwinsManagementClientConfiguration(AzureConfiguration): + """Configuration for AzureDigitalTwinsManagementClient + 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(AzureDigitalTwinsManagementClientConfiguration, 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-digitaltwins/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/__init__.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/__init__.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/__init__.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/__init__.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_azure_digital_twins_management_client_enums.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_azure_digital_twins_management_client_enums.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_azure_digital_twins_management_client_enums.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_azure_digital_twins_management_client_enums.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_models.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_models.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models.py index 63f480f26cb..1d68896e19a 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_models.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models.py @@ -13,29 +13,6 @@ from msrest.exceptions import HttpOperationError -class DigitalTwinsSkuInfo(Model): - """Information about the SKU of the DigitalTwinsInstance. - - 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 name: Required. The name of the SKU. Default value: "F1" . - :vartype name: str - """ - - _validation = { - 'name': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - name = "F1" - - class CheckNameRequest(Model): """The result returned from a database check name availability request. @@ -108,6 +85,29 @@ class CloudError(Model): } +class DigitalTwinsSkuInfo(Model): + """Information about the SKU of the DigitalTwinsInstance. + + 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 name: Required. The name of the SKU. Default value: "F1" . + :vartype name: str + """ + + _validation = { + 'name': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + name = "F1" + + class DigitalTwinsResource(Model): """The common properties of a DigitalTwinsInstance. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_models_py3.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models_py3.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_models_py3.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models_py3.py index d260c445a45..7eb73bca12b 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_models_py3.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_models_py3.py @@ -13,29 +13,6 @@ from msrest.exceptions import HttpOperationError -class DigitalTwinsSkuInfo(Model): - """Information about the SKU of the DigitalTwinsInstance. - - 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 name: Required. The name of the SKU. Default value: "F1" . - :vartype name: str - """ - - _validation = { - 'name': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - name = "F1" - - class CheckNameRequest(Model): """The result returned from a database check name availability request. @@ -108,6 +85,29 @@ class CloudError(Model): } +class DigitalTwinsSkuInfo(Model): + """Information about the SKU of the DigitalTwinsInstance. + + 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 name: Required. The name of the SKU. Default value: "F1" . + :vartype name: str + """ + + _validation = { + 'name': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + name = "F1" + + class DigitalTwinsResource(Model): """The common properties of a DigitalTwinsInstance. diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_paged_models.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_paged_models.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/models/_paged_models.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/models/_paged_models.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/__init__.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/__init__.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/__init__.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/__init__.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_endpoint_operations.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/_digital_twins_endpoint_operations.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_endpoint_operations.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_operations.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/_digital_twins_operations.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_digital_twins_operations.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_operations.py similarity index 100% rename from sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/operations/_operations.py rename to sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/operations/_operations.py diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/version.py new file mode 100644 index 00000000000..b6fb60cec9a --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_03_01_preview/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 = "2020-03-01-preview" + diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/__init__.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/__init__.py new file mode 100644 index 00000000000..29751a31716 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/__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 AzureDigitalTwinsManagementClientConfiguration +from ._azure_digital_twins_management_client import AzureDigitalTwinsManagementClient +__all__ = ['AzureDigitalTwinsManagementClient', 'AzureDigitalTwinsManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py new file mode 100644 index 00000000000..ed236641984 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_azure_digital_twins_management_client.py @@ -0,0 +1,59 @@ +# 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 AzureDigitalTwinsManagementClientConfiguration +from .operations import DigitalTwinsOperations +from .operations import DigitalTwinsEndpointOperations +from .operations import Operations +from . import models + + +class AzureDigitalTwinsManagementClient(SDKClient): + """Azure Digital Twins Client for managing DigitalTwinsInstance + + :ivar config: Configuration for client. + :vartype config: AzureDigitalTwinsManagementClientConfiguration + + :ivar digital_twins: DigitalTwins operations + :vartype digital_twins: azure.mgmt.digitaltwins.operations.DigitalTwinsOperations + :ivar digital_twins_endpoint: DigitalTwinsEndpoint operations + :vartype digital_twins_endpoint: azure.mgmt.digitaltwins.operations.DigitalTwinsEndpointOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.digitaltwins.operations.Operations + + :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 = AzureDigitalTwinsManagementClientConfiguration(credentials, subscription_id, base_url) + super(AzureDigitalTwinsManagementClient, 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 = '2020-10-31' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.digital_twins = DigitalTwinsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.digital_twins_endpoint = DigitalTwinsEndpointOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_configuration.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_configuration.py new file mode 100644 index 00000000000..011639f40f2 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/_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 AzureDigitalTwinsManagementClientConfiguration(AzureConfiguration): + """Configuration for AzureDigitalTwinsManagementClient + 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(AzureDigitalTwinsManagementClientConfiguration, 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-digitaltwins/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/__init__.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/__init__.py new file mode 100644 index 00000000000..5d6b4da43bb --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/__init__.py @@ -0,0 +1,75 @@ +# 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 CheckNameRequest + from ._models_py3 import CheckNameResult + from ._models_py3 import DigitalTwinsDescription + from ._models_py3 import DigitalTwinsEndpointResource + from ._models_py3 import DigitalTwinsEndpointResourceProperties + from ._models_py3 import DigitalTwinsPatchDescription + from ._models_py3 import DigitalTwinsResource + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import EventGrid + from ._models_py3 import EventHub + from ._models_py3 import ExternalResource + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import ServiceBus +except (SyntaxError, ImportError): + from ._models import CheckNameRequest + from ._models import CheckNameResult + from ._models import DigitalTwinsDescription + from ._models import DigitalTwinsEndpointResource + from ._models import DigitalTwinsEndpointResourceProperties + from ._models import DigitalTwinsPatchDescription + from ._models import DigitalTwinsResource + from ._models import ErrorDefinition + from ._models import ErrorResponse, ErrorResponseException + from ._models import EventGrid + from ._models import EventHub + from ._models import ExternalResource + from ._models import Operation + from ._models import OperationDisplay + from ._models import ServiceBus +from ._paged_models import DigitalTwinsDescriptionPaged +from ._paged_models import DigitalTwinsEndpointResourcePaged +from ._paged_models import OperationPaged +from ._azure_digital_twins_management_client_enums import ( + ProvisioningState, + Reason, + EndpointProvisioningState, +) + +__all__ = [ + 'CheckNameRequest', + 'CheckNameResult', + 'DigitalTwinsDescription', + 'DigitalTwinsEndpointResource', + 'DigitalTwinsEndpointResourceProperties', + 'DigitalTwinsPatchDescription', + 'DigitalTwinsResource', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', + 'EventGrid', + 'EventHub', + 'ExternalResource', + 'Operation', + 'OperationDisplay', + 'ServiceBus', + 'DigitalTwinsDescriptionPaged', + 'DigitalTwinsEndpointResourcePaged', + 'OperationPaged', + 'ProvisioningState', + 'Reason', + 'EndpointProvisioningState', +] diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_azure_digital_twins_management_client_enums.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_azure_digital_twins_management_client_enums.py new file mode 100644 index 00000000000..ff6d2b607d9 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_azure_digital_twins_management_client_enums.py @@ -0,0 +1,47 @@ +# 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 ProvisioningState(str, Enum): + + provisioning = "Provisioning" + deleting = "Deleting" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" + deleted = "Deleted" + warning = "Warning" + suspending = "Suspending" + restoring = "Restoring" + moving = "Moving" + + +class Reason(str, Enum): + + invalid = "Invalid" + already_exists = "AlreadyExists" + + +class EndpointProvisioningState(str, Enum): + + provisioning = "Provisioning" + deleting = "Deleting" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" + deleted = "Deleted" + warning = "Warning" + suspending = "Suspending" + restoring = "Restoring" + moving = "Moving" + disabled = "Disabled" diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models.py new file mode 100644 index 00000000000..1ac432b6cea --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_models.py @@ -0,0 +1,626 @@ +# 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 CheckNameRequest(Model): + """The result returned from a database check name availability request. + + 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 name: Required. Resource name. + :type name: str + :ivar type: Required. The type of resource, for instance + Microsoft.DigitalTwins/digitalTwinsInstances. Default value: + "Microsoft.DigitalTwins/digitalTwinsInstances" . + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.DigitalTwins/digitalTwinsInstances" + + def __init__(self, **kwargs): + super(CheckNameRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CheckNameResult(Model): + """The result returned from a check name availability request. + + :param name_available: Specifies a Boolean value that indicates if the + name is available. + :type name_available: bool + :param message: Message indicating an unavailable name due to a conflict, + or a description of the naming rules that are violated. + :type message: str + :param reason: Message providing the reason why the given name is invalid. + Possible values include: 'Invalid', 'AlreadyExists' + :type reason: str or ~azure.mgmt.digitaltwins.models.Reason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckNameResult, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.message = kwargs.get('message', None) + self.reason = kwargs.get('reason', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DigitalTwinsResource(Model): + """The common properties of a DigitalTwinsInstance. + + 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'^(?!-)[A-Za-z0-9-]{3,63}(? None: + super(CheckNameRequest, self).__init__(**kwargs) + self.name = name + + +class CheckNameResult(Model): + """The result returned from a check name availability request. + + :param name_available: Specifies a Boolean value that indicates if the + name is available. + :type name_available: bool + :param message: Message indicating an unavailable name due to a conflict, + or a description of the naming rules that are violated. + :type message: str + :param reason: Message providing the reason why the given name is invalid. + Possible values include: 'Invalid', 'AlreadyExists' + :type reason: str or ~azure.mgmt.digitaltwins.models.Reason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__(self, *, name_available: bool=None, message: str=None, reason=None, **kwargs) -> None: + super(CheckNameResult, self).__init__(**kwargs) + self.name_available = name_available + self.message = message + self.reason = reason + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DigitalTwinsResource(Model): + """The common properties of a DigitalTwinsInstance. + + 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'^(?!-)[A-Za-z0-9-]{3,63}(? None: + super(DigitalTwinsResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class DigitalTwinsDescription(DigitalTwinsResource): + """The description of the DigitalTwins 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] + :ivar created_time: Time when DigitalTwinsInstance was created. + :vartype created_time: datetime + :ivar last_updated_time: Time when DigitalTwinsInstance was updated. + :vartype last_updated_time: datetime + :ivar provisioning_state: The provisioning state. Possible values include: + 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'Warning', 'Suspending', 'Restoring', 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.digitaltwins.models.ProvisioningState + :ivar host_name: Api endpoint to work with DigitalTwinsInstance. + :vartype host_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?!-)[A-Za-z0-9-]{3,63}(? None: + super(DigitalTwinsDescription, self).__init__(location=location, tags=tags, **kwargs) + self.created_time = None + self.last_updated_time = None + self.provisioning_state = None + self.host_name = None + + +class ExternalResource(Model): + """Definition of a resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: Extension resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: 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}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ExternalResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DigitalTwinsEndpointResource(ExternalResource): + """DigitalTwinsInstance endpoint 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: Extension resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. DigitalTwinsInstance endpoint resource + properties. + :type properties: + ~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DigitalTwinsEndpointResourceProperties'}, + } + + def __init__(self, *, properties, **kwargs) -> None: + super(DigitalTwinsEndpointResource, self).__init__(**kwargs) + self.properties = properties + + +class DigitalTwinsEndpointResourceProperties(Model): + """Properties related to Digital Twins Endpoint. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ServiceBus, EventHub, EventGrid + + 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 provisioning_state: The provisioning state. Possible values include: + 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + :vartype provisioning_state: str or + ~azure.mgmt.digitaltwins.models.EndpointProvisioningState + :ivar created_time: Time when the Endpoint was added to + DigitalTwinsInstance. + :vartype created_time: datetime + :param dead_letter_secret: Dead letter storage secret. Will be obfuscated + during read. + :type dead_letter_secret: str + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'created_time': {'readonly': True}, + 'endpoint_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'dead_letter_secret': {'key': 'deadLetterSecret', 'type': 'str'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + } + + _subtype_map = { + 'endpoint_type': {'ServiceBus': 'ServiceBus', 'EventHub': 'EventHub', 'EventGrid': 'EventGrid'} + } + + def __init__(self, *, dead_letter_secret: str=None, **kwargs) -> None: + super(DigitalTwinsEndpointResourceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.created_time = None + self.dead_letter_secret = dead_letter_secret + self.endpoint_type = None + + +class DigitalTwinsPatchDescription(Model): + """The description of the DigitalTwins service. + + :param tags: Instance tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(DigitalTwinsPatchDescription, self).__init__(**kwargs) + self.tags = tags + + +class ErrorDefinition(Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Service specific error code which serves as the substatus for + the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.digitaltwins.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(Model): + """Error response. + + :param error: Error description + :type error: ~azure.mgmt.digitaltwins.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class EventGrid(DigitalTwinsEndpointResourceProperties): + """Properties related to EventGrid. + + 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 provisioning_state: The provisioning state. Possible values include: + 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + :vartype provisioning_state: str or + ~azure.mgmt.digitaltwins.models.EndpointProvisioningState + :ivar created_time: Time when the Endpoint was added to + DigitalTwinsInstance. + :vartype created_time: datetime + :param dead_letter_secret: Dead letter storage secret. Will be obfuscated + during read. + :type dead_letter_secret: str + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param topic_endpoint: Required. EventGrid Topic Endpoint + :type topic_endpoint: str + :param access_key1: Required. EventGrid secondary accesskey. Will be + obfuscated during read. + :type access_key1: str + :param access_key2: EventGrid secondary accesskey. Will be obfuscated + during read. + :type access_key2: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'created_time': {'readonly': True}, + 'endpoint_type': {'required': True}, + 'topic_endpoint': {'required': True}, + 'access_key1': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'dead_letter_secret': {'key': 'deadLetterSecret', 'type': 'str'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'topic_endpoint': {'key': 'TopicEndpoint', 'type': 'str'}, + 'access_key1': {'key': 'accessKey1', 'type': 'str'}, + 'access_key2': {'key': 'accessKey2', 'type': 'str'}, + } + + def __init__(self, *, topic_endpoint: str, access_key1: str, dead_letter_secret: str=None, access_key2: str=None, **kwargs) -> None: + super(EventGrid, self).__init__(dead_letter_secret=dead_letter_secret, **kwargs) + self.topic_endpoint = topic_endpoint + self.access_key1 = access_key1 + self.access_key2 = access_key2 + self.endpoint_type = 'EventGrid' + + +class EventHub(DigitalTwinsEndpointResourceProperties): + """Properties related to EventHub. + + 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 provisioning_state: The provisioning state. Possible values include: + 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + :vartype provisioning_state: str or + ~azure.mgmt.digitaltwins.models.EndpointProvisioningState + :ivar created_time: Time when the Endpoint was added to + DigitalTwinsInstance. + :vartype created_time: datetime + :param dead_letter_secret: Dead letter storage secret. Will be obfuscated + during read. + :type dead_letter_secret: str + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param connection_string_primary_key: Required. PrimaryConnectionString of + the endpoint. Will be obfuscated during read. + :type connection_string_primary_key: str + :param connection_string_secondary_key: SecondaryConnectionString of the + endpoint. Will be obfuscated during read. + :type connection_string_secondary_key: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'created_time': {'readonly': True}, + 'endpoint_type': {'required': True}, + 'connection_string_primary_key': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'dead_letter_secret': {'key': 'deadLetterSecret', 'type': 'str'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'connection_string_primary_key': {'key': 'connectionStringPrimaryKey', 'type': 'str'}, + 'connection_string_secondary_key': {'key': 'connectionStringSecondaryKey', 'type': 'str'}, + } + + def __init__(self, *, connection_string_primary_key: str, dead_letter_secret: str=None, connection_string_secondary_key: str=None, **kwargs) -> None: + super(EventHub, self).__init__(dead_letter_secret=dead_letter_secret, **kwargs) + self.connection_string_primary_key = connection_string_primary_key + self.connection_string_secondary_key = connection_string_secondary_key + self.endpoint_type = 'EventHub' + + +class Operation(Model): + """DigitalTwins service REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | + delete} + :vartype name: str + :param display: Operation properties display + :type display: ~azure.mgmt.digitaltwins.models.OperationDisplay + :ivar origin: The intended executor of the operation. + :vartype origin: str + :ivar is_data_action: If the operation is a data action (for data plane + rbac). + :vartype is_data_action: bool + """ + + _validation = { + 'name': {'readonly': True}, + 'origin': {'readonly': True}, + 'is_data_action': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + } + + def __init__(self, *, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + self.origin = None + self.is_data_action = None + + +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 DigitalTwins + :vartype provider: str + :ivar resource: Resource Type: DigitalTwinsInstances + :vartype resource: str + :ivar operation: Name of the operation + :vartype operation: str + :ivar description: Friendly description for the operation, + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class ServiceBus(DigitalTwinsEndpointResourceProperties): + """Properties related to ServiceBus. + + 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 provisioning_state: The provisioning state. Possible values include: + 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + :vartype provisioning_state: str or + ~azure.mgmt.digitaltwins.models.EndpointProvisioningState + :ivar created_time: Time when the Endpoint was added to + DigitalTwinsInstance. + :vartype created_time: datetime + :param dead_letter_secret: Dead letter storage secret. Will be obfuscated + during read. + :type dead_letter_secret: str + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param primary_connection_string: Required. PrimaryConnectionString of the + endpoint. Will be obfuscated during read. + :type primary_connection_string: str + :param secondary_connection_string: SecondaryConnectionString of the + endpoint. Will be obfuscated during read. + :type secondary_connection_string: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'created_time': {'readonly': True}, + 'endpoint_type': {'required': True}, + 'primary_connection_string': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'dead_letter_secret': {'key': 'deadLetterSecret', 'type': 'str'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + } + + def __init__(self, *, primary_connection_string: str, dead_letter_secret: str=None, secondary_connection_string: str=None, **kwargs) -> None: + super(ServiceBus, self).__init__(dead_letter_secret=dead_letter_secret, **kwargs) + self.primary_connection_string = primary_connection_string + self.secondary_connection_string = secondary_connection_string + self.endpoint_type = 'ServiceBus' diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_paged_models.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_paged_models.py new file mode 100644 index 00000000000..d8a87d7af10 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/models/_paged_models.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.paging import Paged + + +class DigitalTwinsDescriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`DigitalTwinsDescription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DigitalTwinsDescription]'} + } + + def __init__(self, *args, **kwargs): + + super(DigitalTwinsDescriptionPaged, self).__init__(*args, **kwargs) +class DigitalTwinsEndpointResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`DigitalTwinsEndpointResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DigitalTwinsEndpointResource]'} + } + + def __init__(self, *args, **kwargs): + + super(DigitalTwinsEndpointResourcePaged, self).__init__(*args, **kwargs) +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/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/__init__.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/__init__.py new file mode 100644 index 00000000000..b55c490cd11 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/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 ._digital_twins_operations import DigitalTwinsOperations +from ._digital_twins_endpoint_operations import DigitalTwinsEndpointOperations +from ._operations import Operations + +__all__ = [ + 'DigitalTwinsOperations', + 'DigitalTwinsEndpointOperations', + 'Operations', +] diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py new file mode 100644 index 00000000000..99aae08aee0 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_endpoint_operations.py @@ -0,0 +1,387 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class DigitalTwinsEndpointOperations(object): + """DigitalTwinsEndpointOperations 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: Version of the DigitalTwinsInstance Management API. Constant value: "2020-10-31". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-10-31" + + self.config = config + + def list( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Get DigitalTwinsInstance Endpoints. + + :param resource_group_name: The name of the resource group that + contains the DigitalTwinsInstance. + :type resource_group_name: str + :param resource_name: The name of the DigitalTwinsInstance. + :type resource_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 DigitalTwinsEndpointResource + :rtype: + ~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResourcePaged[~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResource] + :raises: + :class:`ErrorResponseException` + """ + 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=64, min_length=1), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^(?!-)[A-Za-z0-9-]{3,63}(?`. + :return: DigitalTwinsEndpointResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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', max_length=64, min_length=1), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^(?!-)[A-Za-z0-9-]{3,63}(? if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResource]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + endpoint_name=endpoint_name, + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DigitalTwinsEndpointResource', 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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}'} + + + def _delete_initial( + self, resource_group_name, resource_name, endpoint_name, custom_headers=None, raw=False, **operation_config): + # 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', max_length=64, min_length=1), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^(?!-)[A-Za-z0-9-]{3,63}(? if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.digitaltwins.models.DigitalTwinsEndpointResource]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + endpoint_name=endpoint_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DigitalTwinsEndpointResource', 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) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}'} diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py new file mode 100644 index 00000000000..4d5cc890564 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_digital_twins_operations.py @@ -0,0 +1,575 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class DigitalTwinsOperations(object): + """DigitalTwinsOperations 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: Version of the DigitalTwinsInstance Management API. Constant value: "2020-10-31". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-10-31" + + self.config = config + + def get( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Get DigitalTwinsInstances resource. + + :param resource_group_name: The name of the resource group that + contains the DigitalTwinsInstance. + :type resource_group_name: str + :param resource_name: The name of the DigitalTwinsInstance. + :type resource_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: DigitalTwinsDescription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.digitaltwins.models.DigitalTwinsDescription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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', max_length=64, min_length=1), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^(?!-)[A-Za-z0-9-]{3,63}(? if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.digitaltwins.models.DigitalTwinsDescription] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.digitaltwins.models.DigitalTwinsDescription]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + location=location, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DigitalTwinsDescription', 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.DigitalTwins/digitalTwinsInstances/{resourceName}'} + + def update( + self, resource_group_name, resource_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Update metadata of DigitalTwinsInstance. + + :param resource_group_name: The name of the resource group that + contains the DigitalTwinsInstance. + :type resource_group_name: str + :param resource_name: The name of the DigitalTwinsInstance. + :type resource_name: str + :param tags: Instance tags + :type tags: dict[str, 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: DigitalTwinsDescription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.digitaltwins.models.DigitalTwinsDescription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + digital_twins_patch_description = models.DigitalTwinsPatchDescription(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', max_length=64, min_length=1), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^(?!-)[A-Za-z0-9-]{3,63}(? if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.digitaltwins.models.DigitalTwinsDescription] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.digitaltwins.models.DigitalTwinsDescription]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DigitalTwinsDescription', 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) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get all the DigitalTwinsInstances 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 DigitalTwinsDescription + :rtype: + ~azure.mgmt.digitaltwins.models.DigitalTwinsDescriptionPaged[~azure.mgmt.digitaltwins.models.DigitalTwinsDescription] + :raises: + :class:`ErrorResponseException` + """ + 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', min_length=10) + + 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.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DigitalTwinsDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get all the DigitalTwinsInstances in a resource group. + + :param resource_group_name: The name of the resource group that + contains the DigitalTwinsInstance. + :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 DigitalTwinsDescription + :rtype: + ~azure.mgmt.digitaltwins.models.DigitalTwinsDescriptionPaged[~azure.mgmt.digitaltwins.models.DigitalTwinsDescription] + :raises: + :class:`ErrorResponseException` + """ + 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', max_length=64, min_length=1) + } + 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', min_length=10) + + 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.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DigitalTwinsDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances'} + + def check_name_availability( + self, location, name, custom_headers=None, raw=False, **operation_config): + """Check if a DigitalTwinsInstance name is available. + + :param location: Location of DigitalTwinsInstance. + :type location: str + :param name: Resource name. + :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: CheckNameResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.digitaltwins.models.CheckNameResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + digital_twins_instance_check_name = models.CheckNameRequest(name=name) + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str', min_length=3) + } + 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', min_length=10) + + # 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(digital_twins_instance_check_name, 'CheckNameRequest') + + # 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.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckNameResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability'} diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_operations.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/operations/_operations.py new file mode 100644 index 00000000000..4c2ccf57d84 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/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: Version of the DigitalTwinsInstance Management API. Constant value: "2020-10-31". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-10-31" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available DigitalTwins service 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.digitaltwins.models.OperationPaged[~azure.mgmt.digitaltwins.models.Operation] + :raises: + :class:`ErrorResponseException` + """ + 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', min_length=10) + + 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.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DigitalTwins/operations'} diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/version.py new file mode 100644 index 00000000000..ac2482d2d88 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/v2020_10_31/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 = "2020-10-31" + diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/version.py b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/version.py index e0ec669828c..9ed7b1240a1 100644 --- a/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/version.py +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/azure/mgmt/digitaltwins/version.py @@ -9,5 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" - +VERSION = "1.0.0"